diff --git a/co-kkiri/src/components/commons/Gnb/Gnb.styled.ts b/co-kkiri/src/components/commons/Gnb/Gnb.styled.ts index abf8ad5b..f57a80ea 100644 --- a/co-kkiri/src/components/commons/Gnb/Gnb.styled.ts +++ b/co-kkiri/src/components/commons/Gnb/Gnb.styled.ts @@ -60,6 +60,31 @@ export const PostButton = styled.div` } `; +export const UserInfoWrapper = styled.div` + display: flex; + align-items: center; + gap: 0.8rem; + cursor: pointer; + + img { + border-radius: 50%; + } +`; + +export const ProfileImg = styled.img` + width: 3.6rem; + height: 3.6rem; + object-fit: cover; +`; + +export const Nickname = styled.div` + ${typography.font14Medium} + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + flex-shrink: 1; +`; + export const SignButton = styled.button` ${typography.font14Medium}; &:hover { diff --git a/co-kkiri/src/components/commons/Gnb/GnbUserInfo.tsx b/co-kkiri/src/components/commons/Gnb/GnbUserInfo.tsx new file mode 100644 index 00000000..7203ca22 --- /dev/null +++ b/co-kkiri/src/components/commons/Gnb/GnbUserInfo.tsx @@ -0,0 +1,24 @@ +import { IMAGES } from "@/constants/images"; +import * as S from "./Gnb.styled"; + +interface GnbUserInfoProps { + user: { + id: number; + nickname: string; + profileImageUrl: string; + }; + onClick: () => void; +} + +export default function GnbUserInfo({ user, onClick }: GnbUserInfoProps) { + return ( + + {user.profileImageUrl ? ( + + ) : ( + {IMAGES.profileImg.alt} + )} + {user.nickname} + + ); +} diff --git a/co-kkiri/src/components/commons/Gnb/index.tsx b/co-kkiri/src/components/commons/Gnb/index.tsx index 8e6e2145..3817c138 100644 --- a/co-kkiri/src/components/commons/Gnb/index.tsx +++ b/co-kkiri/src/components/commons/Gnb/index.tsx @@ -1,17 +1,17 @@ -import { useState } from "react"; import { Link } from "react-router-dom"; import * as S from "./Gnb.styled"; import { ROUTER_PATH } from "@/lib/path"; import { ICONS } from "@/constants/icons"; import { IMAGES } from "@/constants/images"; -import UserInfo from "../UserInfo"; import UserPopover from "../UserPopover"; import AuthModal from "@/components/modals/AuthModal"; import useOpenToggle from "@/hooks/useOpenToggle"; import useAuthModalToggleStore from "@/stores/authModalToggle"; +import GnbUserInfo from "./GnbUserInfo"; interface GnbProps { user?: { + id: number; nickname: string; profileImageUrl: string; }; @@ -45,7 +45,7 @@ export default function Gnb({ user, onSideBarClick }: GnbProps) { 스터디 모집하기 {user ? ( - + ) : ( 로그인/회원가입 )} diff --git a/co-kkiri/src/components/commons/UserPopover.tsx b/co-kkiri/src/components/commons/UserPopover.tsx index 1fddf9e5..e40653a5 100644 --- a/co-kkiri/src/components/commons/UserPopover.tsx +++ b/co-kkiri/src/components/commons/UserPopover.tsx @@ -34,8 +34,6 @@ const { typography, mediaQueries, color, boxShadow, zIndex } = DESIGN_TOKEN; const Container = styled.div<{ $isPopoverOpen: boolean }>` ${zIndex.popover} display: ${({ $isPopoverOpen }) => ($isPopoverOpen ? "block" : "none")}; - opacity: ${({ $isPopoverOpen }) => ($isPopoverOpen ? 1 : 0)}; - transition: opacity 0.2s ease-in-out; position: absolute; right: 4rem; diff --git a/co-kkiri/src/layouts/Navigation.tsx b/co-kkiri/src/layouts/Navigation.tsx index 086bf8ef..8c925a24 100644 --- a/co-kkiri/src/layouts/Navigation.tsx +++ b/co-kkiri/src/layouts/Navigation.tsx @@ -6,10 +6,8 @@ import Gnb from "@/components/commons/Gnb"; import SideBar from "@/components/commons/SideBar"; import { useWindowSize } from "usehooks-ts"; import { slideIn, slideOut } from "@/utils/animation"; -import { useState } from "react"; export default function Navigation() { - const [isOpen, setIsOpen] = useState(false); const isSideBarOpen = useSideBarStore((state) => state.isSideBarOpen); const toggleSideBar = useSideBarStore((state) => state.toggleSideBar); @@ -25,8 +23,8 @@ export default function Navigation() { {isSideBarOpen && isTabletOrMobile && } + {!isTabletOrMobile && {}} />} - {!isTabletOrMobile && {}} />}