mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
cleared profile sidebar
This commit is contained in:
parent
8a71d3d462
commit
5e40fd793d
2 changed files with 16 additions and 12 deletions
|
@ -1,14 +1,17 @@
|
||||||
import React, { VFC } from 'react';
|
import React, { useCallback, VFC } from 'react';
|
||||||
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import { Filler } from '~/components/containers/Filler';
|
import { Filler } from '~/components/containers/Filler';
|
||||||
import { Group } from '~/components/containers/Group';
|
import { Group } from '~/components/containers/Group';
|
||||||
import { Button } from '~/components/input/Button';
|
import { Button } from '~/components/input/Button';
|
||||||
|
import { Icon } from '~/components/input/Icon';
|
||||||
|
import { MenuButton, MenuItemWithIcon } from '~/components/menu';
|
||||||
import { VerticalMenu } from '~/components/menu/VerticalMenu';
|
import { VerticalMenu } from '~/components/menu/VerticalMenu';
|
||||||
import { useStackContext } from '~/components/sidebar/SidebarStack';
|
import { useStackContext } from '~/components/sidebar/SidebarStack';
|
||||||
import { ProfileSidebarHead } from '~/containers/profile/ProfileSidebarHead';
|
import { ProfileSidebarHead } from '~/containers/profile/ProfileSidebarHead';
|
||||||
import { ProfileStats } from '~/containers/profile/ProfileStats';
|
import { ProfileStats } from '~/containers/profile/ProfileStats';
|
||||||
|
import { useAuth } from '~/hooks/auth/useAuth';
|
||||||
import markdown from '~/styles/common/markdown.module.scss';
|
import markdown from '~/styles/common/markdown.module.scss';
|
||||||
|
|
||||||
import styles from './styles.module.scss';
|
import styles from './styles.module.scss';
|
||||||
|
@ -18,8 +21,14 @@ interface ProfileSidebarMenuProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProfileSidebarMenu: VFC<ProfileSidebarMenuProps> = ({ onClose }) => {
|
const ProfileSidebarMenu: VFC<ProfileSidebarMenuProps> = ({ onClose }) => {
|
||||||
|
const { logout } = useAuth();
|
||||||
const { setActiveTab } = useStackContext();
|
const { setActiveTab } = useStackContext();
|
||||||
|
|
||||||
|
const onLogout = useCallback(() => {
|
||||||
|
logout();
|
||||||
|
onClose();
|
||||||
|
}, [onClose]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.wrap}>
|
<div className={styles.wrap}>
|
||||||
<div>
|
<div>
|
||||||
|
@ -30,8 +39,6 @@ const ProfileSidebarMenu: VFC<ProfileSidebarMenuProps> = ({ onClose }) => {
|
||||||
<Group>
|
<Group>
|
||||||
<VerticalMenu className={styles.menu}>
|
<VerticalMenu className={styles.menu}>
|
||||||
<VerticalMenu.Item onClick={() => setActiveTab(0)}>Настройки</VerticalMenu.Item>
|
<VerticalMenu.Item onClick={() => setActiveTab(0)}>Настройки</VerticalMenu.Item>
|
||||||
<VerticalMenu.Item onClick={() => setActiveTab(1)}>Заметки</VerticalMenu.Item>
|
|
||||||
<VerticalMenu.Item onClick={() => setActiveTab(2)}>Удалённые посты</VerticalMenu.Item>
|
|
||||||
</VerticalMenu>
|
</VerticalMenu>
|
||||||
|
|
||||||
<div className={styles.stats}>
|
<div className={styles.stats}>
|
||||||
|
@ -40,14 +47,11 @@ const ProfileSidebarMenu: VFC<ProfileSidebarMenuProps> = ({ onClose }) => {
|
||||||
</Group>
|
</Group>
|
||||||
</Filler>
|
</Filler>
|
||||||
|
|
||||||
<Group className={styles.buttons}>
|
<Group className={styles.buttons} horizontal>
|
||||||
<Button round onClick={onClose} color="outline">
|
<Filler />
|
||||||
Выйти
|
<MenuButton icon={<Button color="link"><Icon icon="dots-vertical" size={24} /></Button>} position="top-end">
|
||||||
</Button>
|
<MenuItemWithIcon onClick={onLogout}>Выйти</MenuItemWithIcon>
|
||||||
|
</MenuButton>
|
||||||
<Button round onClick={onClose} color="outline-white">
|
|
||||||
Закрыть
|
|
||||||
</Button>
|
|
||||||
</Group>
|
</Group>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -15,7 +15,7 @@ interface ProfileSidebarProps extends DialogComponentProps {
|
||||||
const ProfileSidebar: VFC<ProfileSidebarProps> = ({ onRequestClose }) => {
|
const ProfileSidebar: VFC<ProfileSidebarProps> = ({ onRequestClose }) => {
|
||||||
return (
|
return (
|
||||||
<SidebarWrapper onClose={onRequestClose}>
|
<SidebarWrapper onClose={onRequestClose}>
|
||||||
<SidebarStack>
|
<SidebarStack initialTab={0}>
|
||||||
<SidebarStackCard headerFeature="close" title="Профиль" onBackPress={onRequestClose}>
|
<SidebarStackCard headerFeature="close" title="Профиль" onBackPress={onRequestClose}>
|
||||||
<ProfileSidebarMenu onClose={onRequestClose} />
|
<ProfileSidebarMenu onClose={onRequestClose} />
|
||||||
</SidebarStackCard>
|
</SidebarStackCard>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue