@nexusui/components
Version:
These are custom components specially-developed for NexusUI applications. They will make your life easier by giving you out-of-the-box implementations for various high-level UI elements that you can drop directly into your application.
75 lines (74 loc) • 2.07 kB
TypeScript
import { ReactNode } from 'react';
import { MenuItemProps } from '@mui/material/MenuItem';
import { IUserInfo } from '../../models';
import { ButtonPropsWithTestId } from '../../models/MuiExtension.type';
export interface NotificationAction {
/**
* action label
*/
label: ReactNode;
/**
* action callback function
* @param notification notification data
* @returns void
*/
onClick: (notification: NotificationData) => void;
}
export interface ButtonAction extends NotificationAction {
/**
* Addition button props for the button action
*/
props?: ButtonPropsWithTestId;
}
export interface MenuItemAction extends NotificationAction {
/**
* Addition menu item props for the button action
*/
props?: MenuItemProps;
}
export interface NotificationData {
/**
* User info for the notification
*/
user?: IUserInfo;
/**
* Unique id for this notification
*/
id: string;
/**
* Notification type, related doc: https://hexagonmi.atlassian.net/wiki/spaces/GEN/pages/44486688939/Supported+In-App+Notification+Type+Continuous+updated
*/
notificationType?: string;
/**
* Notification title
*/
title: ReactNode;
/**
* If true, the notification will show a badge dot indicating that it hasn't been read.
* @default false
*/
unread?: boolean;
/**
* Which product is the notification linked to
*/
productName: string;
/**
* Create time to show for this notification
*/
createTime: string | Date;
/**
* Addition button actions for this notification if needed.
*/
buttonActions?: ReadonlyArray<ButtonAction>;
/**
* Addition menu actions for this notification if needed.
*/
menuActions?: ReadonlyArray<MenuItemAction>;
/**
* Notification status value
*/
status?: 'warning' | 'error' | 'info';
}
export interface NotificationItemData extends NotificationData {
nestedNotifications?: ReadonlyArray<NotificationData>;
}