diff --git a/src/components/main/Header/index.tsx b/src/components/main/Header/index.tsx index 21fdf43f..20b10d35 100644 --- a/src/components/main/Header/index.tsx +++ b/src/components/main/Header/index.tsx @@ -36,7 +36,7 @@ const HeaderUnconnected: FC = memo( const [is_scrolled, setIsScrolled] = useState(false); const onLogin = useCallback(() => showDialog(DIALOGS.LOGIN), [showDialog]); - const onProfileClick = useCallback(() => authOpenProfile(username), [authOpenProfile, user]); + // const onProfileClick = useCallback(() => authOpenProfile(username), [authOpenProfile, user]); const onScroll = useCallback(() => { const active = window.scrollY > 32; @@ -77,7 +77,7 @@ const HeaderUnconnected: FC = memo( )} {is_user && ( - + )} {!is_user && ( diff --git a/src/components/main/UserButton/index.tsx b/src/components/main/UserButton/index.tsx index bb5c55d8..e965e102 100644 --- a/src/components/main/UserButton/index.tsx +++ b/src/components/main/UserButton/index.tsx @@ -1,37 +1,51 @@ -import React, { FC } from 'react'; +import React, { FC, useCallback } 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'; import { PRESETS } from '~/constants/urls'; -import { Link } from 'react-router-dom'; +import { authOpenProfile } from '~/redux/auth/actions'; interface IProps { user: Partial; onLogout: () => void; - onProfileClick: () => void; + authOpenProfile: typeof authOpenProfile; } -const UserButton: FC = ({ user: { username, photo }, onProfileClick, onLogout }) => ( -
- -
- {username} -
+const UserButton: FC = ({ user: { username, photo }, authOpenProfile, onLogout }) => { + const onProfileOpen = useCallback(() => { + authOpenProfile(username, 'profile'); + }, [authOpenProfile, username]); -
- {(!photo || !photo.id) && } -
-
+ const onSettingsOpen = useCallback(() => { + authOpenProfile(username, 'settings'); + }, [authOpenProfile, username]); -
-
Выдох
+ // const onMessagesOpen = useCallback(() => { + // authOpenProfile(username, 'messages'); + // }, [authOpenProfile, username]); + + return ( +
+ +
{username}
+ +
+ {(!photo || !photo.id) && } +
+
+ +
+
Профиль
+
Настройки
+
Выдох
+
-
-); + ); +}; export { UserButton }; diff --git a/src/components/main/UserButton/styles.scss b/src/components/main/UserButton/styles.scss index 1cbac717..9ba7fd16 100644 --- a/src/components/main/UserButton/styles.scss +++ b/src/components/main/UserButton/styles.scss @@ -17,6 +17,8 @@ z-index: 1; box-sizing: border-box; padding: $gap; + display: none; + flex-direction: column; &::after { content: ' '; @@ -29,6 +31,7 @@ right: 0; top: -4px; transform: translate(-20px, 0); + z-index: -1; } & > div { @@ -38,6 +41,8 @@ box-sizing: border-box; transition: opacity 0.25s; width: 100%; + padding-right: 40px; + transition: background-color 0.25s; &:first-child { border-top-left-radius: $radius; @@ -48,6 +53,10 @@ border-bottom-left-radius: $radius; border-bottom-right-radius: $radius; } + + &:hover { + background-color: $secondary; + } } &:hover > div {