-
Notifications
You must be signed in to change notification settings - Fork 1
Feature: 프로필 페이지 구현 #9
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
10944f7
feat: my, developer 라우팅 경로 추가
Monixc 5d9b857
feat: my, developer 페이지 퍼블리싱
Monixc a6195c0
Merge branch 'develop' of https://github.com/prgrms-fullstack-devcour…
Monixc 8eb6dd4
feat: 개발자 페이지 탭 및 프로필, 작성글 컴포넌트 추가
Monixc dbbf68e
fix: DeveloperPage 레이아웃 수정
Monixc 946612a
fix: ProfileSection 이미지 미리보기 로직 개선
Monixc 205188e
fix: DeveloperPage 탭 변경 로직 개선
Monixc 9bc145b
fix: 마이페이지 메뉴 관련 constants 타입 강화
Monixc 7928a20
fix: AppTabs 및 DeveloperPage 타입 안전성 강화
Monixc 9771de0
feat: ProfileSection 컴포넌트 추가 및 경로 수정
Monixc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import { useRef, useState } from "react"; | ||
| import { Button } from "@/components/ui/button"; | ||
| import { Camera } from "lucide-react"; | ||
|
|
||
| interface ProfileSectionProps { | ||
| isEditable?: boolean; | ||
| } | ||
|
|
||
| export const ProfileSection = ({ isEditable = false }: ProfileSectionProps) => { | ||
| const fileInputRef = useRef<HTMLInputElement>(null); | ||
| const [imagePreview, setImagePreview] = useState<string | null>(null); | ||
|
|
||
| const handleImageClick = () => { | ||
| if (!isEditable) return; | ||
| fileInputRef.current?.click(); | ||
| }; | ||
|
|
||
| const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
| const file = event.target.files?.[0]; | ||
| if (file) { | ||
| const reader = new FileReader(); | ||
|
|
||
| reader.onloadend = () => { | ||
| if (typeof reader.result === "string") { | ||
| setImagePreview(reader.result); | ||
| } | ||
| }; | ||
| reader.readAsDataURL(file); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <div className="flex flex-col items-center mt-8"> | ||
| <div className="relative"> | ||
| <div | ||
| className={`w-32 h-32 rounded-full bg-brand-primary flex items-center justify-center overflow-hidden ${ | ||
| isEditable ? "cursor-pointer" : "" | ||
| }`} | ||
| onClick={handleImageClick}> | ||
| {imagePreview ? ( | ||
| <img | ||
| src={imagePreview} | ||
| alt="Profile preview" | ||
| className="w-full h-full object-cover" | ||
| /> | ||
| ) : ( | ||
| isEditable && <Camera className="size-12 text-brand-background" /> | ||
| )} | ||
| </div> | ||
| {isEditable && ( | ||
| <input | ||
| type="file" | ||
| ref={fileInputRef} | ||
| onChange={handleFileChange} | ||
| className="hidden" | ||
| accept="image/*" | ||
| /> | ||
| )} | ||
| </div> | ||
| <h2 className="text-2xl font-bold mt-4 text-white">이름</h2> | ||
| <p className="text-brand-text mt-1">나이 · 포지션</p> | ||
| {isEditable && ( | ||
| <Button | ||
| variant="outline" | ||
| className="mt-4 bg-transparent border-brand-surface text-white hover:bg-brand-surface/50 hover:text-white"> | ||
| 프로필 설정 | ||
| </Button> | ||
| )} | ||
| </div> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| export const MENU_ITEMS = [ | ||
| { id: "posts", label: "작성한 글" }, | ||
| { id: "history", label: "활동 이력" }, | ||
| { id: "likes", label: "좋아요 한 글" }, | ||
| { id: "bookmarks", label: "북마크" }, | ||
| ] as const; | ||
|
|
||
| export type MenuItemId = (typeof MENU_ITEMS)[number]["id"]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| export const DEVELOPER_TABS = [ | ||
| { | ||
| value: "profile", | ||
| label: "프로필", | ||
| }, | ||
| { | ||
| value: "posts", | ||
| label: "작성한 글 ", | ||
| }, | ||
| ] as const; | ||
|
|
||
| export type DeveloperTabValue = (typeof DEVELOPER_TABS)[number]["value"]; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| const Posts = () => { | ||
| return <h1>작성글</h1>; | ||
| }; | ||
|
|
||
| export default Posts; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| const Profile = () => { | ||
| return <h1>프로필</h1>; | ||
| }; | ||
|
|
||
| export default Profile; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import { useState } from "react"; | ||
| import { AppTabs } from "@/components/common/AppTabs"; | ||
| import { ProfileSection } from "@/components/profile/ProfileSection.tsx"; | ||
| import type { DeveloperTabValue } from "@/constants/profile"; | ||
| import { DEVELOPER_TABS } from "@/constants/profile"; | ||
| import Posts from "./_components/Posts.tsx"; | ||
| import Profile from "./_components/Profile.tsx"; | ||
|
|
||
| export const DeveloperPage = () => { | ||
| const [activeTab, setActiveTab] = useState<DeveloperTabValue>("profile"); | ||
|
|
||
| const handleTabChange = (value: DeveloperTabValue) => { | ||
| setActiveTab(value); | ||
| }; | ||
|
|
||
| return ( | ||
| <div className="dark text-foreground flex flex-col -mx-4"> | ||
| <div className="px-4"> | ||
| <ProfileSection /> | ||
| </div> | ||
| <AppTabs | ||
| tabs={DEVELOPER_TABS} | ||
| value={activeTab} | ||
| onValueChange={handleTabChange} | ||
| listClassName="grid-cols-2" | ||
| className="w-full mt-8" | ||
| /> | ||
| <div className="w-full mt-4 text-white px-4"> | ||
| {activeTab === "profile" && <Profile />} | ||
| {activeTab === "posts" && <Posts />} | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import { ProfileSection } from "@/components/profile/ProfileSection"; | ||
| import { ChevronRight } from "lucide-react"; | ||
| import { MENU_ITEMS, type MenuItemId } from "@/constants/my"; | ||
|
|
||
| export const MyPage = () => { | ||
| const handleMenuItemClick = (menuId: MenuItemId) => { | ||
| console.log(`선택된 메뉴: ${menuId}`); | ||
| }; | ||
|
|
||
| return ( | ||
| <div className="dark text-foreground flex flex-col items-center"> | ||
| <ProfileSection isEditable /> | ||
| <div className="w-full mt-8 border-t border-brand-surface"> | ||
| <ul className="text-white"> | ||
| {MENU_ITEMS.map((item) => ( | ||
| <li | ||
| key={item.id} | ||
| onClick={() => handleMenuItemClick(item.id)} | ||
| className="flex justify-between items-center py-4 border-b border-brand-surface cursor-pointer hover:bg-brand-surface/50 transition-colors"> | ||
| <span>{item.label}</span> | ||
| <ChevronRight className="size-5 text-brand-text" /> | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
label값 끝에 불필요한 공백이 포함되어 있습니다. UI에 의도치 않은 영향을 줄 수 있으므로 제거하는 것이 좋습니다.