// @flow import * as React from "react"; import { Notification, Dropdown } from "../"; import type { Props as NotificationProps } from "./Notification.react"; export type Props = {| /** * Notification components */ +children?: React.ChildrenArray>, /** * An array containing objects of notification data */ +notificationsObjects?: Array, /** * Display a small red circle to symbolize that there are unread notifications */ +unread?: boolean, /** * Action to run when the 'Mark All As Read' button is activated */ +markAllAsRead?: () => void, |}; /** * An Icon triggered Dropdown containing Notifications */ function NotificationTray(props: Props): React.Node { const { children, unread, notificationsObjects, markAllAsRead } = props; const notifications = children && React.Children.toArray(children); return ( } toggle={false} icon="bell" isNavLink={true} position="bottom-end" arrow={true} arrowPosition="right" flex items={ {(notifications && notifications.map((n: React.Node, i) => ( {n} ))) || (notificationsObjects && notificationsObjects.map((n, i) => ( )))} {markAllAsRead && unread && ( markAllAsRead()} > Mark all as read )} } /> ); } export default NotificationTray;