diff --git a/src/components/header/Header/Header.module.scss b/src/components/header/Header/Header.module.scss index e225705e..32b517b9 100644 --- a/src/components/header/Header/Header.module.scss +++ b/src/components/header/Header/Header.module.scss @@ -73,34 +73,5 @@ @include flexbox($gap: 0.8rem); } } - - &-alarm-list, - &-user-menu { - @include responsive(T) { - right: 1.5rem; - } - - position: absolute; - top: 100%; - right: 0; - margin-top: 0.8rem; - } - } -} - -.drawer-menu { - position: absolute; - top: 0; - left: 0; - transform: translateX(-100%); - - &.open { - transform: translateX(0); - animation: slide-in-left ease-in-out 0.3s; - } - - &.close { - transform: translateX(-100%); - animation: slide-out-left ease-in-out 0.3s; } } diff --git a/src/components/header/Header/index.tsx b/src/components/header/Header/index.tsx index fb1a5cce..dcf67c41 100644 --- a/src/components/header/Header/index.tsx +++ b/src/components/header/Header/index.tsx @@ -1,20 +1,8 @@ -import { useEffect, useState } from 'react'; - import classNames from 'classnames/bind'; import { PAGE_PATHS, SVGS } from '@/constants/index'; -import Alarm from '@/components/header/Alarm'; -import AlarmList from '@/components/header/AlarmList'; -import { HeaderSigninButton, HeaderSignupButton } from '@/components/header/buttons'; -import DrawerMenu from '@/components//header/DrawerMenu'; -import HeaderProfile from '@/components/header/HeaderProfile'; import Menu from '@/components/header/Menu'; -import UserMenu from '@/components/header/UserMenu'; -import { useDeviceType } from '@/hooks/useDeviceType'; -import useTogglePopup from '@/hooks/useTogglePopup'; - -import { UsersResponse, MyNotifications } from '@/types/index'; import styles from './Header.module.scss'; @@ -22,114 +10,30 @@ const cx = classNames.bind(styles); const { url, alt } = SVGS.drawerMenu; type HeaderProps = { - userData: UsersResponse; - alarmData: MyNotifications; - isLoggedIn: boolean; + children: React.ReactNode; + logoName: string; + menuList: string[]; + onClick: () => void; }; -const Header = ({ userData, alarmData, isLoggedIn }: HeaderProps) => { - const currentDeviceType = useDeviceType(); - const isMobileHidden = currentDeviceType !== 'Mobile'; - - const [isVisible, setIsVisible] = useState(); - const [isAlarmExisted, setIsAlarmExisted] = useState(false); - - useEffect(() => { - if (isMobileHidden) { - setIsVisible(undefined); - } - }, [isMobileHidden]); - - const handleToggleDrawerMenu = () => { - setIsVisible((prev) => !prev); - }; - - const { - isOpen: isAlarmActivated, - popupRef: alarmListRef, - buttonRef: alarmRef, - togglePopup: handleAlarmActivation, - } = useTogglePopup(); - - const { - isOpen: isHeaderProfileActivated, - popupRef: userMenuRef, - buttonRef: headerProfileRef, - togglePopup: handleHeaderProfileActivation, - } = useTogglePopup(); - - const totalCount = alarmData?.totalCount; - const notifications = alarmData?.notifications; - - useEffect(() => { - setIsAlarmExisted(totalCount > 0); - }, [totalCount]); - - const email = userData?.email; - const nickname = userData?.nickname; - const profileImageUrl = userData?.profileImageUrl || ''; - +const Header = ({ children, logoName, menuList, onClick }: HeaderProps) => { return ( - <> -
-
- - - GGF - -
-
- -
-
- {isLoggedIn && alarmData && userData ? ( - <> - - - - ) : ( - <> - - - - )} -
-
-
- {isAlarmActivated && ( -
- -
- )} - {isHeaderProfileActivated && ( -
- +
+
+ + + {logoName} + +
+
+
- )} -
-
- -
- +
{children}
+
+ +
); };