@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.
41 lines (37 loc) • 1.16 kB
JavaScript
"use client";
import { jsx, jsxs } from 'react/jsx-runtime';
import { useRef, forwardRef, Children } from 'react';
import { classNames } from '../utils/class-names.js';
import { useVisibleCallback } from '../utils/use-visible.js';
function ReachEndMarker({
enabled,
onReachEnd
}) {
const markerRef = useRef(null);
useVisibleCallback(markerRef, onReachEnd, {
enabled
});
return /* @__PURE__ */ jsx("div", {
ref: markerRef,
style: { height: 0 }
});
}
const InboxNotificationList = forwardRef(({ onReachEnd, children, className, ...props }, forwardedRef) => {
return /* @__PURE__ */ jsxs("ol", {
className: classNames("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