UNPKG

@liveblocks/react-ui

Version:

A set of React pre-built components for the Liveblocks products. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.

49 lines (45 loc) 1.24 kB
"use client"; import { jsx, jsxs } from 'react/jsx-runtime'; import { useRef, forwardRef, Children } from 'react'; import { cn } from '../utils/cn.js'; import { useIntersectionCallback } from '../utils/use-visible.js'; function ReachEndMarker({ enabled, onReachEnd }) { const markerRef = useRef(null); useIntersectionCallback( markerRef, (isIntersecting) => { if (isIntersecting) { onReachEnd(); } }, { enabled } ); return /* @__PURE__ */ jsx("div", { ref: markerRef, style: { height: 0 } }); } const InboxNotificationList = forwardRef(({ onReachEnd, children, className, ...props }, forwardedRef) => { return /* @__PURE__ */ jsxs("ol", { className: cn("lb-root lb-inbox-notification-list", className), ...props, ref: forwardedRef, children: [ Children.map(children, (child, index) => /* @__PURE__ */ jsx("li", { className: "lb-inbox-notification-list-item", children: child }, index)), onReachEnd && /* @__PURE__ */ jsx(ReachEndMarker, { onReachEnd, enabled: Children.count(children) > 0 }) ] }); }); export { InboxNotificationList }; //# sourceMappingURL=InboxNotificationList.js.map