-
Notifications
You must be signed in to change notification settings - Fork 0
마이페이지 추가 #23
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
마이페이지 추가 #23
Changes from all commits
4f140ec
9e7e7dd
18067ae
a91ab10
5c67ac8
e2c78fd
dff04d2
33402e9
3f338b3
75671f3
f6ca295
8c3740e
dc916b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { useSuspenseQuery } from '@tanstack/react-query'; | ||
| import { getUserInfo } from './auth'; | ||
|
|
||
| export const useGetUserInfo = () => { | ||
| return useSuspenseQuery({ | ||
| queryKey: ['userInfo'], | ||
| queryFn: getUserInfo, | ||
| }); | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| export interface User { | ||
| id: number; | ||
| email: string; | ||
| name: string; | ||
| profileImageUrl?: string; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| export const ProfileContainer = styled.div` | ||
| display: flex; | ||
| align-items: center; | ||
| padding: ${({ theme }) => theme.unit[20]}; | ||
| gap: ${({ theme }) => theme.unit[16]}; | ||
| min-height: 5.925rem; | ||
| background-color: ${({ theme }) => | ||
| theme.color.semantic.background.normal.alternative}; | ||
| `; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { useNavigate } from 'react-router'; | ||
| import { useTheme } from 'styled-components'; | ||
| import { useGetUserInfo } from '@/entities/auth/api/useGetUserInfo'; | ||
| import { ROUTE } from '@/shared/config/route'; | ||
| import MemberProfileImage from '@/shared/ui/MemberProfileImage'; | ||
| import Flex from '@/shared/ui/Flex'; | ||
| import Text from '@/shared/ui/Text'; | ||
| import Button from '@/shared/ui/Button'; | ||
| import * as S from './index.styles'; | ||
|
|
||
| function MyProfile() { | ||
| const { data: profile } = useGetUserInfo(); | ||
| const navigate = useNavigate(); | ||
| const theme = useTheme(); | ||
|
|
||
| return ( | ||
| <S.ProfileContainer> | ||
| <MemberProfileImage size="sm" src={profile?.profileImageUrl} /> | ||
| <Flex direction="column" flex={1} gap={4}> | ||
| <Text variant="body1Sb">{profile.name}</Text> | ||
| {/* TODO: 디자인 시스템 정비 후 다시 디자인 확인이 필요합니다 (Opacity를 계속 쓰는지?) */} | ||
| <Text | ||
| variant="body2R" | ||
| color="semantic.text.default" | ||
| style={{ opacity: 0.5 }} | ||
| > | ||
| {profile.email} | ||
| </Text> | ||
| </Flex> | ||
| {/* TODO: 현 피그마 디자인은 Chip이 Button으로 쓰이고 있는 상황이라 우선 button 컴포넌트 기준으로 구현했습니다. 디자인시스템 정리 후 다시 확인이 필요합니다! */} | ||
| <Button | ||
| size="sm" | ||
| onClick={() => navigate(ROUTE.myEdit)} | ||
| style={{ | ||
| backgroundColor: theme.color.semantic.background.normal.inverse, | ||
| }} | ||
| > | ||
| 정보수정 | ||
| </Button> | ||
|
Comment on lines
+30
to
+39
Contributor
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. 현재 Chip이 버튼처럼 쓰이고 있는 부분이 많아서(홈 화면에서도 버튼처럼 쓰이고 있습니다), 홈페이지 디자인 반영 PR에서 Chip에 onClick props를 추가했습니다!
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. Chip에 onClick props를 추가할 수도 있지만 클릭 가능한 칩을 별도의 컴포넌트로 분리하는 것도 방법이 될 수 있을 것 같아요! 아직 수진님이 디자인 시스템을 정리중이시라 확정된 컴포넌트는 아니지만 지금까지 정리된 것을 봤을 땐 클릭 가능한 칩 형태의 컴포넌트는(홈 화면에 쓰이는 것!) tab 컴포넌트로 따로 분류되어 있더라구요. 이 부분에서 컴포넌트 정리하실 때 일반 칩이랑 클릭 가능한 칩을 분리하려는 의도가 아닐까 하는 생각을 했거든요. 제가 구현할 때 여길 TODO 로 남겨뒀던 이유는 클릭 가능한 컴포넌트는 button으로 정의하는 것이 역할이나 접근성 측면에서 더 좋지 않을까? 하는 생각에서였는데요. 만약에 홈 화면 tab 말고 다른 곳에서도 칩이 버튼처럼 사용되고 있는 부분이 있다면 좀 더 생각해봐야겠지만,,,
Contributor
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. 아하 이 부분은 수진님과 논의가 더 필요하겠네요. |
||
| </S.ProfileContainer> | ||
| ); | ||
| } | ||
|
|
||
| export default MyProfile; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { default as MyProfile } from './MyProfile'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| function MyEditPage() { | ||
| return <div>정보 수정 페이지</div>; | ||
| } | ||
|
|
||
| export default MyEditPage; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { default as MyEditPage } from './MyEditPage'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| export const ProfileContainer = styled.div` | ||
| display: flex; | ||
| align-items: center; | ||
| padding: ${({ theme }) => theme.unit[20]}; | ||
| gap: ${({ theme }) => theme.unit[16]}; | ||
| min-height: 5.925rem; | ||
| background-color: ${({ theme }) => | ||
| theme.color.semantic.background.normal.alternative}; | ||
| `; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { Suspense } from 'react'; | ||
| import { useNavigate } from 'react-router'; | ||
| import { useTheme } from 'styled-components'; | ||
| import { Menu } from '@/shared/assets/svgs/icon'; | ||
| import Header from '@/shared/ui/Header'; | ||
| import { ROUTE } from '@/shared/config/route'; | ||
| import { MyProfile } from '@/features/user-profile/ui'; | ||
| import * as S from './MyPage.styles'; | ||
|
|
||
| function MyPage() { | ||
| const navigate = useNavigate(); | ||
| const { color } = useTheme(); | ||
|
|
||
| return ( | ||
| <> | ||
| {/* TODO: 디자인 시스템 정리 + 헤더 컴포넌트 정비 후에 다시 스타일링이 필요합니다. */} | ||
| <Header | ||
| type="TitleCenter" | ||
| title="마이페이지" | ||
| rightButtonContent={<Menu width={24} />} | ||
| rightButtonOnClick={() => navigate(ROUTE.myEdit)} | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| bgColor={color.semantic.background.normal.alternative} | ||
| /> | ||
| <Suspense fallback={<S.ProfileContainer>로딩 중...</S.ProfileContainer>}> | ||
| <MyProfile /> | ||
| </Suspense> | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
| export default MyPage; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { default as MyPage } from './MyPage'; |
Uh oh!
There was an error while loading. Please reload this page.