NotificationContent.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import React from 'react';
  2. import { PagePathLabel } from '@growi/ui';
  3. import { InAppNotification as IInAppNotification } from '../../interfaces/in-app-notification';
  4. import FormattedDistanceDate from '../FormattedDistanceDate';
  5. interface Props {
  6. actionUsers: string
  7. notification: IInAppNotification
  8. onClick: () => void
  9. }
  10. export const PageCommentNotification = (props: Props): JSX.Element => {
  11. const pagePath = { path: props.notification.target.path };
  12. return (
  13. <>
  14. <div>
  15. <b>{props.actionUsers}</b> commented on <PagePathLabel page={pagePath} />
  16. </div>
  17. <i className="fa fa-comment-o mr-2" />
  18. <FormattedDistanceDate id={props.notification._id} date={props.notification.createdAt} isShowTooltip={false} />
  19. </>
  20. );
  21. };
  22. export const PageUpdateNotification = (props: Props): JSX.Element => {
  23. const pagePath = { path: props.notification.target.path };
  24. return (
  25. <>
  26. <div>
  27. <b>{props.actionUsers}</b> page updated on <PagePathLabel page={pagePath} />
  28. </div>
  29. <i className="fa fa-file-o mr-2" />
  30. <FormattedDistanceDate id={props.notification._id} date={props.notification.createdAt} isShowTooltip={false} />
  31. </>
  32. );
  33. };