1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00
vault-frontend/src/containers/profile/ProfileSidebarHead/index.tsx
2022-03-29 15:39:29 +07:00

29 lines
916 B
TypeScript

import React, { VFC } from 'react';
import { Filler } from '~/components/containers/Filler';
import { Group } from '~/components/containers/Group';
import { ProfileAvatar } from '~/components/profile/ProfileAvatar';
import { usePatchUser } from '~/hooks/auth/usePatchUser';
import { useUser } from '~/hooks/auth/useUser';
import styles from './styles.module.scss';
interface ProfileSidebarHeadProps {}
const ProfileSidebarHead: VFC<ProfileSidebarHeadProps> = () => {
const { user } = useUser();
const { updatePhoto } = usePatchUser();
return (
<Group horizontal>
<ProfileAvatar canEdit onChangePhoto={updatePhoto} photo={user.photo} size={72} />
<Filler>
<div className={styles.name}>{user.fullname || user.username}</div>
<div className={styles.username}>{!!user.fullname && `~${user.username}`}</div>
</Filler>
</Group>
);
};
export { ProfileSidebarHead };