Skip to content

Conversation

@yuj2n
Copy link
Contributor

@yuj2n yuj2n commented Jun 7, 2025

📌 변경 사항 개요

헤더 공통 컴포넌트 작성

✨ 요약

  • 헤더 공통 컴포넌트 작성
  • 공통 컴포넌트 적용을 위한 대시보드 수정 페이지 작성
  • 사용자 상태 관리 저장 및 타입 정의

📝 상세 내용

🎨style

  • 로고 이미지 favicon 추가
  • 프로필 대체 이미지 및 버튼 아이콘 추가

✨Feat

  • 헤더 공통 컴포넌트 적용 확인을 위한 대시보드 수정 페이지 작성
  • 대시보드 수정 페이지 공통 헤더 적용
  • Zustand 기반 사용자 상태 관리 저장 및 타입 정의
  • 공통 헤더 컴포넌트 기초 UI 구현

Header.tsx에서 use client 사용 이유:

useRouter()가 서버 컴포넌트에서 호출하면 동작하지 않으며 클라이언트에서만 동작하는 기능이기 때문.

🔍 서버 컴포넌트에서 사용 불가한 이유
  1. useRouter()는 브라우저 API에 의존
  • 내부적으로 location.href, URLSearchParams 등 브라우저 객체 사용
  • 서버 컴포넌트는 Node.js 환경에서 렌더링되므로 브라우저 객체 존재 X -> 에러 발생
  1. useRouter()는 React 클라이언트 훅
  • useRouter()는 React의 클아이언트 전용 훅처럼 작동
  • 서버에서는 React의 렌더링 흐름에 맞지 않아 라우터 컨텍스트가 주입되지 X
  • 컨텍스트는 클라이언트가 브라우저에서 앱을 실행할 때 자동으로 설정

🔗 관련 이슈

#7

🖼️ 스크린샷

20250607_185856.mp4

✅ 체크리스트

  • 브랜치 네이밍 컨벤션을 준수했습니다
  • 커밋 컨벤션을 준수했습니다
  • 코드가 프로젝트의 스타일 가이드라인을 준수합니다

💡 참고 사항

  • import 순서와 관련해서 Run autofix to sort these imports!라는 eslint 오류가 계속해서 뜹니다!
  • clsx랑 tailwind Merge 라이브러리 설치했습니다!

@yuj2n yuj2n added this to the 1차 구현 기간 milestone Jun 7, 2025
@yuj2n yuj2n self-assigned this Jun 7, 2025
@yuj2n yuj2n added the ✨Feat 기능 개발 label Jun 7, 2025
@yuj2n yuj2n linked an issue Jun 7, 2025 that may be closed by this pull request
1 task
@yuj2n yuj2n added the 🎨Style UI, 스타일 관련 수정 label Jun 7, 2025
@yuj2n yuj2n changed the base branch from main to develop June 7, 2025 10:48
Copy link

@LeeCh0129 LeeCh0129 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헤더 컴포넌트를 잘구현해주셨고, 상태 관리와 persist 미들웨어로 상태 유지 구현까지 미리 잘 작성해주셨네요. 고생하셨습니다~👍

Copy link

@Insung-Jo Insung-Jo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 남겼습니다! 헤더 작성 잘해주셨고 논의 사항이나 궁금한 점은 리뷰로 남겨드렸습니다!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분은 저도 비슷하게 작성하고 있어서 제가 PR 올리기 전에 같이 살펴보고 결정하는 게 좋을 거 같아요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵!!

// alias 설정
"@/*": ["./src/*"],
"@components/*": ["./src/app/shared/components/*"],
"@store/*": ["./src/app/shared/store/*"],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

store로 바로 연결할 수 있게 추가해주셨군요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아무래도 자주 사용할 것 같아서 추가해놨습니당

Copy link
Contributor

@dkslel1225 dkslel1225 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

파비콘, 라이브러리 추가 감사합니다! 헤더 레이아웃 잘 잡아주셨네요👍, 고생하셨습니다~~
질문 하나 남겨뒀으니 확인 부탁드립니당

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">
Copy link
Contributor

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 사용하시면 더 간결하게 다크모드 적용 가능합니다!
혹시 직접 특정 색상을 사용하고 싶으셨던 건가요??

Copy link
Contributor Author

@yuj2n yuj2n Jun 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

일단 임시로 적어둔 거라 추후 수정할 계획입니당!!

@yuj2n yuj2n merged commit ac1010e into CoPlay-FE:develop Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨Feat 기능 개발 🎨Style UI, 스타일 관련 수정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨Feat: 공통 헤더 컴포넌트 작성

4 participants