diff --git a/src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/ProfileLoggedIn.tsx b/src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/ProfileLoggedIn.tsx index 59c01a6af..b8d0fc6bb 100644 --- a/src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/ProfileLoggedIn.tsx +++ b/src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/ProfileLoggedIn.tsx @@ -2,10 +2,12 @@ import { Dispatch, FC, SetStateAction, useContext, useState } from 'react' import { Avatar, + ComponentVisible, IconOutline, logInfo, profileContext, ProfileContextData, + useHideClickOutside, } from '../../../../../lib' import { ProfilePanel } from './profile-panel' @@ -20,18 +22,33 @@ const ProfileLoggedIn: FC = (props: ProfileLoggedInProps) const { profile }: ProfileContextData = useContext(profileContext) const [profilePanelOpen, setProfilePanelOpen]: [boolean, Dispatch>] = useState(false) + const { + isComponentVisible, + ref, + setIsComponentVisible, + }: ComponentVisible = useHideClickOutside(false) + if (!profile) { logInfo('tried to render the logged in profile w/out a profile') return <> } function toggleProfilePanel(): void { - setProfilePanelOpen(!profilePanelOpen) + const toggleTo: boolean = !profilePanelOpen + setProfilePanelOpen(toggleTo) + setIsComponentVisible(toggleTo) + } + + if (!isComponentVisible && profilePanelOpen) { + setProfilePanelOpen(isComponentVisible) } return ( <> -
toggleProfilePanel()} > +
= (props: ProfileLoggedInProps)
{profilePanelOpen && ( diff --git a/src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/profile-panel/ProfilePanel.tsx b/src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/profile-panel/ProfilePanel.tsx index a6af31c73..616ae0b04 100644 --- a/src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/profile-panel/ProfilePanel.tsx +++ b/src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/profile-panel/ProfilePanel.tsx @@ -1,4 +1,4 @@ -import { FC, useContext } from 'react' +import { FC, MutableRefObject, useContext } from 'react' import { Link } from 'react-router-dom' import { @@ -12,6 +12,7 @@ import { import styles from './ProfilePanel.module.scss' interface ProfilePanelProps { + refObject: MutableRefObject settingsTitle: string toggleProfilePanel: () => void } @@ -27,7 +28,10 @@ const ProfilePanel: FC = (props: ProfilePanelProps) => { } return ( -
+
{profile.handle}
diff --git a/src/lib/styles/_cards.scss b/src/lib/card/Card.module.scss similarity index 69% rename from src/lib/styles/_cards.scss rename to src/lib/card/Card.module.scss index 6a2926890..293ae1e89 100644 --- a/src/lib/styles/_cards.scss +++ b/src/lib/card/Card.module.scss @@ -1,10 +1,9 @@ -@import './palette'; -@import './typography'; +@import '../styles'; .card { - padding: 16px 16px 32px 16px; - border: solid 1px $black-10; - border-radius: 8px; + padding: $pad-lg $pad-lg $pad-xxxxl $pad-lg; + border: solid $border-xs $black-10; + border-radius: $pad-sm; .card-title { @include font-weight-semi-bold; diff --git a/src/lib/button/Buttons.test.tsx b/src/lib/card/Card.test.tsx similarity index 74% rename from src/lib/button/Buttons.test.tsx rename to src/lib/card/Card.test.tsx index 0dae599ff..2544dd797 100644 --- a/src/lib/button/Buttons.test.tsx +++ b/src/lib/card/Card.test.tsx @@ -1,6 +1,6 @@ import '@testing-library/jest-dom' -describe('
+ -
- -
-
- Reset Password -
- -
- +
+