ModelNotification.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import type { FC } from 'react';
  2. import React from 'react';
  3. import type { HasObjectId } from '@growi/core';
  4. import { PagePathLabel } from '@growi/ui/dist/components';
  5. import type { IInAppNotification } from '~/interfaces/in-app-notification';
  6. import FormattedDistanceDate from '../../FormattedDistanceDate';
  7. import styles from './ModelNotification.module.scss';
  8. type Props = {
  9. notification: IInAppNotification & HasObjectId
  10. actionMsg: string
  11. actionIcon: string
  12. actionUsers: string
  13. };
  14. export const ModelNotification: FC<Props> = (props) => {
  15. const {
  16. notification, actionMsg, actionIcon, actionUsers,
  17. } = props;
  18. return (
  19. <div className={`${styles['modal-notification']} p-2 overflow-hidden`}>
  20. <div className="text-truncate page-title">
  21. <b>{actionUsers}</b>
  22. {actionMsg}
  23. <PagePathLabel path={notification.parsedSnapshot?.path ?? ''} />
  24. </div>
  25. <span className="material-symbols-outlined me-2">{actionIcon}</span>
  26. <FormattedDistanceDate
  27. id={notification._id}
  28. date={notification.createdAt}
  29. isShowTooltip={false}
  30. differenceForAvoidingFormat={Number.POSITIVE_INFINITY}
  31. />
  32. </div>
  33. );
  34. };