Skip to content

Commit be5ddfb

Browse files
authored
Merge pull request #97 from hyeonjiroh/design/#94/mypage-layout
design: #94/마이페이지 레이아웃
2 parents 9797601 + 20f0659 commit be5ddfb

5 files changed

Lines changed: 129 additions & 1 deletion

File tree

public/icon/arrow_right_icon.svg

Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"use client";
2+
3+
import { useRouter } from "next/navigation";
4+
import Image from "next/image";
5+
import BackIcon from "../../../../../public/icon/arrow_right_icon.svg";
6+
7+
export default function BackButton() {
8+
const router = useRouter();
9+
10+
return (
11+
<div>
12+
<button
13+
type="button"
14+
onClick={() => {
15+
router.back();
16+
}}
17+
className="flex gap-2 items-center"
18+
>
19+
<Image
20+
src={BackIcon}
21+
className="scale-x-[-1] w-[18px] h-[18px] tablet:w-[18px] tablet:h-[18px]"
22+
alt=""
23+
/>
24+
<div className="font-medium text-md text-gray-800 tablet:text-lg">
25+
돌아가기
26+
</div>
27+
</button>
28+
</div>
29+
);
30+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"use client";
2+
3+
import Button from "@/components/common/button/Button";
4+
import Input from "@/components/common/input/Input";
5+
6+
export default function PasswordSection() {
7+
return (
8+
<div className="w-full p-4 rounded-lg bg-white tablet:p-6">
9+
<div className="flex flex-col gap-10 tablet:gap-6">
10+
<div className="font-bold text-2lg text-gray-800 tablet:text-2xl">
11+
비밀번호 변경
12+
</div>
13+
<div className="flex flex-col gap-6">
14+
<div className="flex flex-col gap-4">
15+
{/* 로그인/회원가입 페이지에서 한 것 처럼 패스워드 토글 버튼 넣어도 좋을 것 같네요 */}
16+
<Input type="password" label="현재 비밀번호" />
17+
<Input type="password" label="새 비밀번호" />
18+
<Input type="password" label="새 비밀번호 확인" />
19+
</div>
20+
<Button variant="purple">변경</Button>
21+
</div>
22+
</div>
23+
</div>
24+
);
25+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
"use client";
2+
3+
import { useEffect, useState } from "react";
4+
import { UserInfo } from "@/lib/types";
5+
import { fetchUser } from "@/lib/apis/usersApi";
6+
import { TOKEN_1 } from "@/lib/constants/tokens";
7+
import Button from "@/components/common/button/Button";
8+
import ImageInput from "@/components/common/input/ImageInput";
9+
import Input from "@/components/common/input/Input";
10+
11+
export default function ProfileSection() {
12+
const [data, setData] = useState<UserInfo | null>(null);
13+
14+
useEffect(() => {
15+
const getData = async () => {
16+
const res = await fetchUser({
17+
token: TOKEN_1,
18+
});
19+
setData(res);
20+
};
21+
22+
getData();
23+
}, []);
24+
25+
if (!data) return;
26+
27+
const { email, nickname, profileImageUrl } = data;
28+
29+
// 이 밑으로 formData(닉네임, 이미지) state 생성하시고, 기본값으로 각각 위의 nickname, profileImageUrl 넣어주시면 될 거예요
30+
// 아래는 vercel 배포를 위해 위 값들을 임시로 사용한 테스트 코드라 나중에 삭제해주시면 됩니다
31+
console.log(nickname);
32+
console.log(profileImageUrl);
33+
34+
return (
35+
<div className="w-full p-4 rounded-lg bg-white tablet:p-6">
36+
<div className="flex flex-col gap-10 tablet:gap-6">
37+
<div className="font-bold text-2lg text-gray-800 tablet:text-2xl">
38+
프로필
39+
</div>
40+
<div className="flex flex-col gap-10 tablet:flex-row tablet:gap-[42px]">
41+
<div>
42+
<ImageInput variant="profile" />
43+
</div>
44+
<div className="flex flex-col gap-6 grow">
45+
<div className="flex flex-col gap-4">
46+
{/* 이메일 인풋에는 나중에 disabled 속성 들어가야 합니다 */}
47+
<Input label="이메일" value={email} />
48+
<Input label="닉네임" />
49+
</div>
50+
<Button variant="purple">저장</Button>
51+
</div>
52+
</div>
53+
</div>
54+
</div>
55+
);
56+
}
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
import BackButton from "./_components/BackButton";
2+
import PasswordSection from "./_components/PasswordSection";
3+
import ProfileSection from "./_components/ProfileSection";
4+
15
export default function Page() {
2-
return <div>/mypage</div>;
6+
return (
7+
<div className="flex flex-col px-3 py-4">
8+
<div className="flex flex-col gap-[6px] tablet:gap-[29px]">
9+
<BackButton />
10+
<div className="flex flex-col gap-4 max-w-[672px] tablet:gap-6">
11+
<ProfileSection />
12+
<PasswordSection />
13+
</div>
14+
</div>
15+
</div>
16+
);
317
}

0 commit comments

Comments
 (0)