From 27c87bea0a4287a1668edc29ef2305059be77ad9 Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Thu, 28 Jul 2022 14:12:18 +0700 Subject: [PATCH] made better sidebar logout button --- src/components/menu/MenuButton/index.tsx | 6 +++- .../sidebar/SidebarStack/styles.module.scss | 2 +- .../ProfileSidebarLogoutButton/index.tsx | 28 +++++++++++++++++++ .../styles.module.scss | 6 ++++ .../profile/ProfileSidebarMenu/index.tsx | 6 ++-- .../sidebars/ProfileSidebar/index.tsx | 2 +- src/sprites/Sprites.tsx | 10 +++++++ src/styles/_global.scss | 4 +++ 8 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 src/containers/profile/ProfileSidebarLogoutButton/index.tsx create mode 100644 src/containers/profile/ProfileSidebarLogoutButton/styles.module.scss diff --git a/src/components/menu/MenuButton/index.tsx b/src/components/menu/MenuButton/index.tsx index 90ff0f97..24c52242 100644 --- a/src/components/menu/MenuButton/index.tsx +++ b/src/components/menu/MenuButton/index.tsx @@ -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 classNames from 'classnames'; @@ -56,6 +56,10 @@ const MenuButton: FC = ({ const visible = activate === 'focus' ? focus.focused : hover.focused; + useEffect(() => { + popper.update?.(); + }, [visible]); + return ( <> } position="top-end"> + + +
Захотелось наружу?
+
Там холодно, страшно и больше не раздают пончики!
+
+
+ + + +); + +export { ProfileSidebarLogoutButton } \ No newline at end of file diff --git a/src/containers/profile/ProfileSidebarLogoutButton/styles.module.scss b/src/containers/profile/ProfileSidebarLogoutButton/styles.module.scss new file mode 100644 index 00000000..586552f9 --- /dev/null +++ b/src/containers/profile/ProfileSidebarLogoutButton/styles.module.scss @@ -0,0 +1,6 @@ +@import "src/styles/variables"; + +.wrapper { + max-width: 300px; + font: $font_14_regular; +} \ No newline at end of file diff --git a/src/containers/profile/ProfileSidebarMenu/index.tsx b/src/containers/profile/ProfileSidebarMenu/index.tsx index dadcf52f..8cc8a37d 100644 --- a/src/containers/profile/ProfileSidebarMenu/index.tsx +++ b/src/containers/profile/ProfileSidebarMenu/index.tsx @@ -14,6 +14,8 @@ import { ProfileStats } from '~/containers/profile/ProfileStats'; import { useAuth } from '~/hooks/auth/useAuth'; import markdown from '~/styles/common/markdown.module.scss'; +import { ProfileSidebarLogoutButton } from '../ProfileSidebarLogoutButton'; + import styles from './styles.module.scss'; interface ProfileSidebarMenuProps { @@ -49,9 +51,7 @@ const ProfileSidebarMenu: VFC = ({ onClose }) => { - } position="top-end"> - Выйти - +
); diff --git a/src/containers/sidebars/ProfileSidebar/index.tsx b/src/containers/sidebars/ProfileSidebar/index.tsx index 4e17fd44..8aad811b 100644 --- a/src/containers/sidebars/ProfileSidebar/index.tsx +++ b/src/containers/sidebars/ProfileSidebar/index.tsx @@ -15,7 +15,7 @@ interface ProfileSidebarProps extends DialogComponentProps { const ProfileSidebar: VFC = ({ onRequestClose }) => { return ( - + diff --git a/src/sprites/Sprites.tsx b/src/sprites/Sprites.tsx index b7e34144..18bee9f6 100644 --- a/src/sprites/Sprites.tsx +++ b/src/sprites/Sprites.tsx @@ -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" /> + + + + + + + ); diff --git a/src/styles/_global.scss b/src/styles/_global.scss index f1877d76..7cdfcab0 100644 --- a/src/styles/_global.scss +++ b/src/styles/_global.scss @@ -174,3 +174,7 @@ p { #__next { min-height: 100vh; } + +small { + font-size: 0.8em; +} \ No newline at end of file