mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
made better sidebar logout button
This commit is contained in:
parent
be061c966f
commit
27c87bea0a
8 changed files with 58 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
import React, { FC, ReactNode, useState } from 'react';
|
import React, { FC, ReactNode, useEffect, useState } from 'react';
|
||||||
|
|
||||||
import { Placement } from '@popperjs/core';
|
import { Placement } from '@popperjs/core';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
@ -56,6 +56,10 @@ const MenuButton: FC<MenuButtonProps> = ({
|
||||||
|
|
||||||
const visible = activate === 'focus' ? focus.focused : hover.focused;
|
const visible = activate === 'focus' ? focus.focused : hover.focused;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
popper.update?.();
|
||||||
|
}, [visible]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<button
|
<button
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
@import "src/styles/variables";
|
@import "src/styles/variables";
|
||||||
|
|
||||||
.stack {
|
.stack {
|
||||||
background: transparentize($content_bg, 0.1);
|
background: transparentize($content_bg, 0.2);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row-reverse;
|
flex-direction: row-reverse;
|
||||||
width: auto;
|
width: auto;
|
||||||
|
|
28
src/containers/profile/ProfileSidebarLogoutButton/index.tsx
Normal file
28
src/containers/profile/ProfileSidebarLogoutButton/index.tsx
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import React, { FC } from 'react';
|
||||||
|
|
||||||
|
import { Group } from '~/components/containers/Group';
|
||||||
|
import { Padder } from '~/components/containers/Padder';
|
||||||
|
import { Button } from '~/components/input/Button';
|
||||||
|
import { Icon } from '~/components/input/Icon';
|
||||||
|
import { MenuButton } from '~/components/menu';
|
||||||
|
|
||||||
|
import styles from './styles.module.scss';
|
||||||
|
|
||||||
|
interface ProfileSidebarLogoutButtonProps {
|
||||||
|
onLogout?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ProfileSidebarLogoutButton: FC<ProfileSidebarLogoutButtonProps> = ({ onLogout }) => (
|
||||||
|
<MenuButton icon={<Button color="link" iconRight="logout">Выйти</Button>} position="top-end">
|
||||||
|
<Padder className={styles.wrapper}>
|
||||||
|
<Group>
|
||||||
|
<h5>Захотелось наружу?</h5>
|
||||||
|
<div>Там холодно, страшно и больше не раздают пончики!</div>
|
||||||
|
<div />
|
||||||
|
<div><Button onClick={onLogout} color="primary" stretchy>Выпустите меня!</Button></div>
|
||||||
|
</Group>
|
||||||
|
</Padder>
|
||||||
|
</MenuButton>
|
||||||
|
);
|
||||||
|
|
||||||
|
export { ProfileSidebarLogoutButton }
|
|
@ -0,0 +1,6 @@
|
||||||
|
@import "src/styles/variables";
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
max-width: 300px;
|
||||||
|
font: $font_14_regular;
|
||||||
|
}
|
|
@ -14,6 +14,8 @@ import { ProfileStats } from '~/containers/profile/ProfileStats';
|
||||||
import { useAuth } from '~/hooks/auth/useAuth';
|
import { useAuth } from '~/hooks/auth/useAuth';
|
||||||
import markdown from '~/styles/common/markdown.module.scss';
|
import markdown from '~/styles/common/markdown.module.scss';
|
||||||
|
|
||||||
|
import { ProfileSidebarLogoutButton } from '../ProfileSidebarLogoutButton';
|
||||||
|
|
||||||
import styles from './styles.module.scss';
|
import styles from './styles.module.scss';
|
||||||
|
|
||||||
interface ProfileSidebarMenuProps {
|
interface ProfileSidebarMenuProps {
|
||||||
|
@ -49,9 +51,7 @@ const ProfileSidebarMenu: VFC<ProfileSidebarMenuProps> = ({ onClose }) => {
|
||||||
|
|
||||||
<Group className={styles.buttons} horizontal>
|
<Group className={styles.buttons} horizontal>
|
||||||
<Filler />
|
<Filler />
|
||||||
<MenuButton icon={<Button color="link"><Icon icon="dots-vertical" size={24} /></Button>} position="top-end">
|
<ProfileSidebarLogoutButton onLogout={onLogout}/>
|
||||||
<MenuItemWithIcon onClick={onLogout}>Выйти</MenuItemWithIcon>
|
|
||||||
</MenuButton>
|
|
||||||
</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 initialTab={0}>
|
<SidebarStack>
|
||||||
<SidebarStackCard headerFeature="close" title="Профиль" onBackPress={onRequestClose}>
|
<SidebarStackCard headerFeature="close" title="Профиль" onBackPress={onRequestClose}>
|
||||||
<ProfileSidebarMenu onClose={onRequestClose} />
|
<ProfileSidebarMenu onClose={onRequestClose} />
|
||||||
</SidebarStackCard>
|
</SidebarStackCard>
|
||||||
|
|
|
@ -415,6 +415,16 @@ const Sprites: FC = () => (
|
||||||
d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
|
d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
|
||||||
/>
|
/>
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
|
<g id="logout">
|
||||||
|
<path fill="none" d="M0 0h24v24H0V0z" stroke="none" />
|
||||||
|
<path
|
||||||
|
stroke="none"
|
||||||
|
d="M11 13q.425 0 .713-.288Q12 12.425 12 12t-.287-.713Q11.425 11 11 11t-.712.287Q10 11.575 10 12t.288.712Q10.575 13 11 13Zm-4 8v-2l6-1V6.875q0-.375-.225-.675-.225-.3-.575-.35L7 5V3l5.5.9q1.1.2 1.8 1.025T15 6.85v12.8Zm-4 0v-2h2V5q0-.85.588-1.425Q6.175 3 7 3h10q.85 0 1.425.575Q19 4.15 19 5v14h2v2Zm4-2h10V5H7Z"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -174,3 +174,7 @@ p {
|
||||||
#__next {
|
#__next {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
small {
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue