1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-20 21:59:43 +02:00
planka/client/src/components/Header/Header.jsx

63 lines
1.9 KiB
React
Raw Normal View History

2019-08-31 04:07:25 +05:00
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import { Icon, Menu } from 'semantic-ui-react';
import Paths from '../../constants/Paths';
import NotificationsPopup from './NotificationsPopup';
import UserPopup from '../UserPopup';
2019-08-31 04:07:25 +05:00
import styles from './Header.module.css';
const Header = React.memo(
({
user,
notifications,
isEditable,
onUsers,
onNotificationDelete,
2020-04-08 21:12:58 +05:00
onUserSettings,
2019-08-31 04:07:25 +05:00
onLogout,
}) => (
<div className={styles.wrapper}>
<Link to={Paths.ROOT} className={styles.logo}>
Planka
</Link>
<Menu inverted size="large" className={styles.menu}>
<Menu.Menu position="right">
2019-08-31 04:07:25 +05:00
{isEditable && (
<Menu.Item className={styles.item} onClick={onUsers}>
<Icon fitted name="users" />
2019-08-31 04:07:25 +05:00
</Menu.Item>
)}
<NotificationsPopup items={notifications} onDelete={onNotificationDelete}>
<Menu.Item className={styles.item}>
<Icon fitted name="bell" />
{notifications.length > 0 && (
<span className={styles.notification}>{notifications.length}</span>
)}
</Menu.Item>
</NotificationsPopup>
2020-04-08 21:12:58 +05:00
<UserPopup onSettings={onUserSettings} onLogout={onLogout}>
<Menu.Item className={styles.item}>{user.name}</Menu.Item>
</UserPopup>
</Menu.Menu>
</Menu>
</div>
),
2019-08-31 04:07:25 +05:00
);
Header.propTypes = {
/* eslint-disable react/forbid-prop-types */
user: PropTypes.object.isRequired,
notifications: PropTypes.array.isRequired,
/* eslint-enable react/forbid-prop-types */
isEditable: PropTypes.bool.isRequired,
onUsers: PropTypes.func.isRequired,
onNotificationDelete: PropTypes.func.isRequired,
2020-04-08 21:12:58 +05:00
onUserSettings: PropTypes.func.isRequired,
2019-08-31 04:07:25 +05:00
onLogout: PropTypes.func.isRequired,
};
export default Header;