mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
31 lines
937 B
TypeScript
31 lines
937 B
TypeScript
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 };
|