1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00
vault-frontend/src/components/notifications/NotificationMessage/index.tsx
2021-03-03 17:54:58 +07:00

31 lines
937 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { FC, useCallback } from 'react';
import styles from '~/components/notifications/NotificationBubble/styles.module.scss';
import { Icon } from '~/components/input/Icon';
import { IMessageNotification, INotification } from '~/redux/types';
interface IProps {
notification: IMessageNotification;
onClick: (notification: INotification) => void;
}
const NotificationMessage: FC<IProps> = ({
notification,
notification: {
content: { text, from },
},
onClick,
}) => {
const onMouseDown = useCallback(() => onClick(notification), [onClick, notification]);
return (
<div className={styles.item} onMouseDown={onMouseDown}>
<div className={styles.item_head}>
<Icon icon="message" />
<div className={styles.item_title}>Сообщение от ~{from?.username}:</div>
</div>
<div className={styles.item_text}>{text}</div>
</div>
);
};
export { NotificationMessage };