1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-28 14:16:41 +07:00

user menu

This commit is contained in:
Fedor Katurov 2019-11-05 17:14:47 +07:00
parent aff052e66d
commit 8a37fa1f1b
7 changed files with 135 additions and 62 deletions

View file

@ -0,0 +1,28 @@
import React, { FC } from 'react';
import { Group } from '~/components/containers/Group';
import styles from './styles.scss';
import { getURL } from '~/utils/dom';
import { Icon } from '~/components/input/Icon';
import { IUser } from '~/redux/auth/types';
interface IProps {
user: Partial<IUser>;
onLogout: () => void;
}
const UserButton: FC<IProps> = ({ user: { username, photo }, onLogout }) => (
<div className={styles.wrap}>
<Group horizontal className={styles.user_button}>
<div>{username}</div>
<div className={styles.user_avatar} style={{ backgroundImage: `url('${getURL(photo)}')` }}>
{(!photo || !photo.id) && <Icon icon="profile" />}
</div>
</Group>
<div className={styles.menu}>
<div onClick={onLogout}>Выдох</div>
</div>
</div>
);
export { UserButton };