@magicbell/magicbell-react
Version:
React components for building a notification inbox for your app
19 lines • 1.03 kB
JavaScript
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
import { useState } from 'react';
import NotificationList from '../NotificationList/index.js';
/**
* Component that renders an infinite scroll list of notifications, or error
* messages if the list can't be fetched.
*
* @example
* <NotificationInboxContent
* store={notifications}
* onNotificationClick={openTicket}
* height={500} />
*/
export default function NotificationInboxContent({ onNotificationClick, store, height, NotificationItem, }) {
// we use a refSetter so that the height observer is reattached on a ref change
const [contentRef, setContentRef] = useState(null);
return (_jsx("div", { ref: setContentRef, css: { width: '100%', height: height ?? '100%', overflow: 'auto' }, children: contentRef ? (_jsx(NotificationList, { scrollableTarget: contentRef, notifications: store, onItemClick: onNotificationClick, queryParams: store.context, ListItem: NotificationItem })) : null }));
}
//# sourceMappingURL=NotificationInboxContent.js.map