diff --git a/src/components/layout/header/cow-bell/index.tsx b/src/components/layout/header/cow-bell/index.tsx new file mode 100644 index 00000000..bdc0b826 --- /dev/null +++ b/src/components/layout/header/cow-bell/index.tsx @@ -0,0 +1,34 @@ +import Link from 'next/link'; + +import { Icon } from '@/components/icon'; +import { cn } from '@/lib/utils'; +import { useNotification } from '@/providers'; + +export const CowBell = () => { + const { unReadCount, receivedNewNotification } = useNotification(); + + return ( + + + {unReadCount > 0 && ( + <> + + + {unReadCount} + + + )} + + ); +}; diff --git a/src/components/layout/header/header-login/index.tsx b/src/components/layout/header/header-login/index.tsx new file mode 100644 index 00000000..36b9293b --- /dev/null +++ b/src/components/layout/header/header-login/index.tsx @@ -0,0 +1,9 @@ +import Link from 'next/link'; + +export const HeaderLogin = () => { + return ( + + 로그인 + + ); +}; diff --git a/src/components/layout/header/index.tsx b/src/components/layout/header/index.tsx index 2e1009bd..4a2a4a73 100644 --- a/src/components/layout/header/index.tsx +++ b/src/components/layout/header/index.tsx @@ -1,55 +1,22 @@ 'use client'; + import Link from 'next/link'; -import { useRouter } from 'next/navigation'; import { Icon } from '@/components/icon'; -import { cn } from '@/lib/utils'; -import { useAuth, useNotification } from '@/providers'; +import { CowBell } from '@/components/layout/header/cow-bell'; +import { HeaderLogin } from '@/components/layout/header/header-login'; +import { useAuth } from '@/providers'; export const Header = () => { const { isAuthenticated } = useAuth(); - const { unReadCount, receivedNewNotification } = useNotification(); - const router = useRouter(); - - const onLogoClick = (e: React.MouseEvent) => { - e.preventDefault(); - router.push('/'); - }; return (
); diff --git a/src/providers/provider-auth/index.tsx b/src/providers/provider-auth/index.tsx index b90ec8fe..011eb3a0 100644 --- a/src/providers/provider-auth/index.tsx +++ b/src/providers/provider-auth/index.tsx @@ -23,7 +23,7 @@ interface Props { } export const AuthProvider = ({ children, hasRefreshToken }: Props) => { - const [isAuthenticated, setIsAuthenticated] = useState(false); + const [isAuthenticated, setIsAuthenticated] = useState(hasRefreshToken); // 초기값 설정 // 페이지가 새로고침 될 때 accessToken이 없으면 refresh 시도, state update 실행