@magicbell/magicbell-react
Version:
React components for building a notification inbox for your app
31 lines (30 loc) • 1.27 kB
TypeScript
import { INotification, IRemoteNotification, useNotifications } from '@magicbell/react-headless';
import React from 'react';
type NotificationStore = ReturnType<typeof useNotifications>;
export type NotificationListItem = (props: ListItemProps) => React.ReactElement;
export type ClickCallbackFn = (notification: INotification) => void | boolean;
export interface ListItemProps {
notification: IRemoteNotification;
onClick?: ClickCallbackFn;
}
export interface NotificationListProps {
onItemClick?: ClickCallbackFn;
height?: number | string;
ListItem?: (props: ListItemProps) => React.ReactElement;
notifications: NotificationStore;
queryParams?: any;
scrollableTarget?: React.ReactNode;
}
/**
* Infinite scroll list of notifications. Fetches the next page of the
* notifications store when the user scrolls to the bottom of the list.
*
* @example
* <NotificationList
* notifications={new NotificationStore()}
* queryParams={{ read: false }}
* onItemClick={openNotification}
* ListItem={Notification} />
*/
export default function NotificationList({ notifications: store, onItemClick, height, queryParams, scrollableTarget, ListItem, }: NotificationListProps): import("@emotion/react/jsx-runtime").JSX.Element;
export {};