1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 21:06:42 +07:00

notification clicking

This commit is contained in:
Fedor Katurov 2019-11-13 12:16:12 +07:00
parent 9b0c3dd1fb
commit 83c9900af1
4 changed files with 18 additions and 9 deletions

View file

@ -20,6 +20,7 @@ const NotificationBubble: FC<IProps> = ({ notifications }) => {
.map(notification =>
createElement(NOTIFICATION_RENDERERS[notification.type], {
notification,
onClick: console.log,
key: notification.content.id,
})
)}

View file

@ -1,19 +1,24 @@
import React, { FC } from 'react';
import React, { FC, useCallback } from 'react';
import styles from '~/components/notifications/NotificationBubble/styles.scss';
import { Icon } from '~/components/input/Icon';
import { IMessageNotification } from '~/redux/types';
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}>
<div className={styles.item} onMouseDown={onMouseDown}>
<div className={styles.item_head}>
<Icon icon="message" />
<div className={styles.item_title}>Сообщение от ~{from.username}:</div>