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:
parent
aff052e66d
commit
8a37fa1f1b
7 changed files with 135 additions and 62 deletions
28
src/components/main/UserButton/index.tsx
Normal file
28
src/components/main/UserButton/index.tsx
Normal 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 };
|
Loading…
Add table
Add a link
Reference in a new issue