import React from 'react'; import Chip from '@mui/material/Chip'; import Typography from '@mui/material/Typography'; import Box from '@mui/material/Box'; import theme from '../../../config/theme'; import { HermesNotification, OnNotificationClick } from './types'; import { notificationStates } from './defaultStates'; interface NotificationBoxProps { notification: HermesNotification; onNotificationClick?: OnNotificationClick; } const NotificationBox = (props: NotificationBoxProps) => { const { notification, onNotificationClick } = props; const onClickAction = (url: string) => { onNotificationClick && onNotificationClick(notification); if (url.length > 0) { window.location.href = url; } }; const notificationError = notificationStates[notification.id] ?? undefined; return ( {notification.payload.title} {notification.payload.body} {!!notification.action && ( onClickAction(notification.action?.redirectUrl ?? '')} sx={{ textTransform: 'uppercase', color: theme.palette.primary.light, mt: 2, cursor: 'pointer', }} > {notification.action.name} )} ); }; NotificationBox.defaultProps = { isError: false, }; export default NotificationBox;