UNPKG

@magicbell/magicbell-react

Version:

React components for building a notification inbox for your app

22 lines 1.15 kB
import React, { useState } from 'react'; import { useMagicBellContext } from '../../context/MagicBellContext.js'; import NotificationsView from './private/NotificationsView.js'; import PreferencesView from './private/PreferencesView.js'; import StyledContainer from './StyledContainer.js'; /** * Component that renders all notifications as well as a header and a footer. * * @example * <NotificationInbox * storeId="unread" * onNotificationClick={openTicket} * onAllRead={showAlert} /> */ export default function NotificationInbox({ height, layout = ['header', 'content', 'push-notifications-banner', 'footer'], tabs, ...props }) { const [view, setView] = useState('inbox'); const { isFetchingConfig } = useMagicBellContext(); if (isFetchingConfig) return null; return (React.createElement(StyledContainer, { height: height, layout: layout }, view === 'preferences' ? (React.createElement(PreferencesView, { ...props, layout: layout, setView: setView })) : (React.createElement(NotificationsView, { ...props, tabs: tabs, layout: layout, setView: setView })))); } //# sourceMappingURL=NotificationInbox.js.map