Skip to content

Commit d0d6f42

Browse files
committed
✨feat(#163): mypage platform icon 추가
1 parent 31ab606 commit d0d6f42

1 file changed

Lines changed: 33 additions & 2 deletions

File tree

src/app/mypage/page.tsx

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ const MyPage = () => {
1717
const [email, setEmail] = useState('');
1818
const [planetCount, setPlanetCount] = useState(0);
1919
const [letterCount, setLetterCount] = useState(0);
20+
const [platform, setPlatform] = useState('');
21+
2022
const [loading, setLoading] = useState(true);
2123

2224
useEffect(() => {
@@ -62,7 +64,8 @@ const MyPage = () => {
6264
const response = await getUserInfo();
6365
setName(response.data.name);
6466
setEmail(response.data.email);
65-
console.log('회원정보 조회 성공:', response.data);
67+
setPlatform(response.data.socialPlatform);
68+
// console.log('회원정보 조회 성공:', response.data);
6669
} catch (error) {
6770
console.error('회원정보 조회 실패:', error);
6871
}
@@ -78,6 +81,19 @@ const MyPage = () => {
7881
}
7982
};
8083

84+
const EmailType = (platform): string => {
85+
switch (platform) {
86+
case 'GOOGLE':
87+
return '/assets/icons/ic_google.svg';
88+
case 'KAKAO':
89+
return '/assets/icons/ic_kakao_profile.svg';
90+
case 'NAVER':
91+
return '/assets/icons/ic_naver.svg';
92+
default:
93+
return '';
94+
}
95+
};
96+
8197
return (
8298
<Container>
8399
{loading ? (
@@ -96,7 +112,11 @@ const MyPage = () => {
96112
<ProfileInfo>
97113
<ProfileName>{name}님의 스페이스</ProfileName>
98114
<ProfileEmail>
99-
<img src="/assets/icons/ic_kakao_profile.svg" />
115+
<StyledIcon
116+
src={EmailType(platform)}
117+
alt="emailIcon"
118+
platform={platform as keyof typeof iconSizes}
119+
/>
100120
<div>{email}</div>
101121
</ProfileEmail>
102122
<CountRaw>
@@ -242,6 +262,17 @@ const ProfileImage = styled.img`
242262
}
243263
`;
244264

265+
const iconSizes = {
266+
GOOGLE: 20,
267+
KAKAO: 20,
268+
NAVER: 20
269+
} as const;
270+
271+
const StyledIcon = styled.img<{ platform: keyof typeof iconSizes }>`
272+
width: ${({ platform }) => iconSizes[platform]}px;
273+
height: ${({ platform }) => iconSizes[platform]}px;
274+
`;
275+
245276
const ProfileInfo = styled.div`
246277
display: flex;
247278
flex-direction: column;

0 commit comments

Comments
 (0)