-
Notifications
You must be signed in to change notification settings - Fork 2
✨Feat: 공통 헤더 컴포넌트 작성 #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
dc42047
c2889fe
a004085
d7b9a6a
d554d09
9d97a8f
3be262f
bd88fae
0d69725
a2751e5
8af0ca1
bea171a
13371e0
d167f6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import Header from '@components/common/header/Header' | ||
|
|
||
| export default function AboutLayout({ | ||
| children, | ||
| }: { | ||
| children: React.ReactNode | ||
| }) { | ||
| return ( | ||
| <div> | ||
| <Header /> | ||
| <div>{children}</div> {/* 여기에 page.tsx 내용이 들어옴 */} | ||
| </div> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export default function dashBoardEditPage() { | ||
| return <p>대시보드 수정 페이지</p> | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| 'use client' | ||
|
|
||
| import { useUserStore } from '@store/useUserStore' // Zustand 예시 | ||
| import { usePathname, useRouter } from 'next/navigation' | ||
| import Link from 'next/link' | ||
| import Image from 'next/image' | ||
|
|
||
| export default function Header() { | ||
| const pathname = usePathname() | ||
| const router = useRouter() | ||
| const goToMypage = () => { | ||
| router.push('/mypage') | ||
| } | ||
| const { user, logout } = useUserStore() // Zustand 상태 | ||
|
|
||
| return ( | ||
| <header className="flex items-center justify-between border-b border-gray-200 bg-white px-36 py-16 dark:border-gray-700 dark:bg-black"> | ||
| {/* 좌측 대시보드명 */} | ||
| <div className="flex items-center gap-8"> | ||
| <div className="font-bold">대시보드 명</div> | ||
| <div className="relative h-12 w-14 overflow-hidden"> | ||
| <Image src="/images/crown.png" fill alt="내가 만든 대시보드" /> | ||
| </div> | ||
| </div> | ||
|
|
||
| {/* 우측 사용자 정보/다크모드 */} | ||
| <div className="flex items-center gap-16"> | ||
| <> | ||
| <nav className="hidden gap-8 text-sm text-gray-600 dark:text-gray-300 md:flex"> | ||
| <Link | ||
| href="/dashboard" | ||
| className={`flex items-center gap-6 rounded-md border-2 border-solid px-8 py-4 ${pathname === '/dashboard' ? 'font-semibold' : ''}`} | ||
| > | ||
| <div className="relative flex size-12"> | ||
| <Image src="/images/management.png" fill alt="관리 버튼" /> | ||
| </div> | ||
| 관리 | ||
| </Link> | ||
| <Link | ||
| href="/modal" | ||
| className={`flex items-center gap-6 rounded-6 border-2 border-solid px-8 py-4 ${pathname === '/modal' ? 'font-semibold' : ''}`} | ||
| > | ||
| <div className="relative flex size-12"> | ||
| <Image src="/images/invitation.png" fill alt="초대 버튼" /> | ||
| </div> | ||
| 초대하기 | ||
| </Link> | ||
| </nav> | ||
| {/* 공동작업자 프로필 이미지 */} | ||
| <div className="relative size-48 overflow-hidden rounded-full"> | ||
| <Image | ||
| src="/images/collaborator.png" | ||
| fill | ||
| alt="초대된 사용자" | ||
| style={{ objectFit: 'cover' }} | ||
| /> | ||
| </div> | ||
| <div className="relative size-48 overflow-hidden rounded-full"> | ||
| <Image | ||
| src="/images/collaborator.png" | ||
| fill | ||
| alt="초대된 사용자" | ||
| style={{ objectFit: 'cover' }} | ||
| /> | ||
| </div> | ||
| |{/* 내 프로필 이미지 */} | ||
| <div className="relative size-48 overflow-hidden rounded-full"> | ||
| <Image | ||
| src="/images/profile.gif" | ||
| fill | ||
| alt="프로필이미지" | ||
| style={{ objectFit: 'cover' }} | ||
| /> | ||
| </div> | ||
| <span className="text-sm">배유철 {user?.name}</span> | ||
| {/* 드롭다운 메뉴 */} | ||
| <button onClick={goToMypage} className="text-xs"> | ||
| 마이페이지 | ||
| </button> | ||
| <button onClick={logout} className="text-xs"> | ||
| 로그아웃 | ||
| </button> | ||
| </> | ||
| </div> | ||
| </header> | ||
| ) | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 부분은 저도 비슷하게 작성하고 있어서 제가 PR 올리기 전에 같이 살펴보고 결정하는 게 좋을 거 같아요!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 넵!! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // store/useUserStore.ts | ||
| import { create } from 'zustand' | ||
| import { persist } from 'zustand/middleware' | ||
|
|
||
| import { User } from '../types/User.interface' | ||
|
|
||
| interface UserState { | ||
| user: User | null | ||
| accessToken: string | null | ||
| setUser: (user: User, accessToken: string) => void | ||
| logout: () => void // clearUser와 동일 | ||
| } | ||
|
|
||
| export const useUserStore = create<UserState>()( | ||
| persist( | ||
| (set) => ({ | ||
| user: null, | ||
| accessToken: null, | ||
| setUser: (user, accessToken) => set({ user, accessToken }), | ||
| logout: () => set({ user: null, accessToken: null }), | ||
| }), | ||
| { | ||
| name: 'user-storage', | ||
| }, | ||
| ), | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| export interface User { | ||
| id: number | ||
| name: string | ||
| email: string | ||
| avatarUrl?: string // optional | ||
| role?: 'user' | 'admin' // optional 예시 | ||
| createdAt?: string // optional ISO date string | ||
| updatedAt?: string // optional ISO date string | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| // alias 설정 | ||
| "@/*": ["./src/*"], | ||
| "@components/*": ["./src/app/shared/components/*"], | ||
| "@store/*": ["./src/app/shared/store/*"], | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아무래도 자주 사용할 것 같아서 추가해놨습니당 |
||
| "@hooks/*": ["./src/app/shared/hooks/*"] | ||
| } | ||
| }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제가 global.css에 작성해둔 커스텀 유틸 클래스
BG-white, Border-section 사용하시면 더 간결하게 다크모드 적용 가능합니다!
혹시 직접 특정 색상을 사용하고 싶으셨던 건가요??
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
일단 임시로 적어둔 거라 추후 수정할 계획입니당!!