Skip to content

Commit a4c9efd

Browse files
committed
[design] 웰컴모달 ui 구현
1 parent e2e715b commit a4c9efd

File tree

5 files changed

+127
-49
lines changed

5 files changed

+127
-49
lines changed

src/app/login/SocialLogin.tsx

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
'use client';
2+
3+
import Naver from '@/shared/assets/icons/naver.svg';
4+
import Kakao from '@/shared/assets/icons/kakao.svg';
5+
import Google from '@/shared/assets/icons/google.svg';
6+
import tw from '@/shared/utills/tw';
7+
import Welcome from './Welcome';
8+
import { useState } from 'react';
9+
10+
function SocialLogin() {
11+
const [isModalOpen, setIsModalOpen] = useState(false);
12+
13+
const socialButtons = [
14+
{
15+
id: 'naver',
16+
label: 'Naver 로그인',
17+
icon: <Naver />,
18+
style: 'bg-[#00C73C]',
19+
},
20+
{
21+
id: 'kakao',
22+
label: 'Kakao 로그인',
23+
icon: <Kakao />,
24+
style: 'bg-[#FEE500] text-primary',
25+
},
26+
{
27+
id: 'google',
28+
label: 'Google 로그인',
29+
icon: <Google />,
30+
style: 'bg-[#EBEBEB] text-primary',
31+
},
32+
];
33+
34+
// TODO: 백엔드 연동 로직 구현 필요
35+
const handleLogin = (id: string) => {
36+
console.log(id);
37+
setIsModalOpen(true);
38+
};
39+
40+
return (
41+
<>
42+
<div className="flex flex-col gap-5 mt-12 px-3 w-full max-w-[23.75rem]">
43+
{socialButtons.map(({ id, label, icon, style }) => (
44+
<button
45+
key={id}
46+
type="button"
47+
onClick={() => handleLogin(id)}
48+
className={tw('flex-center gap-2 px-5 py-1 w-full rounded-lg', style)}
49+
>
50+
{icon}
51+
<span className="text-xl">{label}</span>
52+
</button>
53+
))}
54+
</div>
55+
56+
{/* 웰컴 모달 (임시) */}
57+
<Welcome open={isModalOpen} onClose={() => setIsModalOpen(false)} />
58+
</>
59+
);
60+
}
61+
export default SocialLogin;

src/app/login/SocialLoginButtons.tsx

Lines changed: 0 additions & 46 deletions
This file was deleted.

src/app/login/Welcome.tsx

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
'use client';
2+
3+
import Image from 'next/image';
4+
5+
import Button from '@/shared/components/button/Button';
6+
import ModalLayout from '@/shared/components/modalPop/ModalLayout';
7+
import Ssury from '@/shared/assets/ssury/ssury_jump.webp';
8+
import { useRouter } from 'next/navigation';
9+
10+
interface Props {
11+
open: boolean;
12+
onClose: () => void;
13+
}
14+
15+
function Welcome({ open, onClose }: Props) {
16+
const router = useRouter();
17+
18+
return (
19+
<ModalLayout
20+
open={open}
21+
onClose={onClose}
22+
title="환영합니다!"
23+
description="바텐더 쑤리가 안내해드릴게요"
24+
buttons={
25+
<>
26+
<Button
27+
type="button"
28+
color="purple"
29+
onClick={() => {
30+
onClose();
31+
router.push('/recipe');
32+
}}
33+
>
34+
칵테일 레시피 보러가기
35+
</Button>
36+
<Button
37+
type="button"
38+
onClick={() => {
39+
onClose();
40+
router.push('/recommend');
41+
}}
42+
>
43+
칵테일 취향 추천받기
44+
</Button>
45+
</>
46+
}
47+
>
48+
<div className="flex-center">
49+
<div className="relative w-32 h-32" aria-hidden>
50+
<Image src={Ssury} alt="" fill className="object-contain" />
51+
</div>
52+
</div>
53+
</ModalLayout>
54+
);
55+
}
56+
export default Welcome;

src/app/login/page.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Image from 'next/image';
22
import type { Metadata } from 'next';
3-
import SocialLoginButtons from './SocialLoginButtons';
43
import loginBg from '@/shared/assets/images/login_bg.webp';
4+
import SocialLogin from './SocialLogin';
55

66
export const metadata: Metadata = {
77
title: 'SSOUL | 로그인',
@@ -17,11 +17,13 @@ function Page() {
1717
>
1818
<Image src={loginBg} alt="" fill className="object-cover md:object-contain object-bottom" />
1919
</div>
20+
2021
<div className="flex flex-col gap-3 text-center">
2122
<h1 className="text-4xl font-bold">로그인</h1>
2223
<p>3초 로그인으로 SSOUL을 가볍게 즐겨보세요🍸</p>
2324
</div>
24-
<SocialLoginButtons />
25+
26+
<SocialLogin />
2527
</div>
2628
);
2729
}

src/shared/components/modalPop/ModalLayout.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ function ModalLayout({
7575
{children && <div className="mt-5 py-2 text-white">{children}</div>}
7676

7777
{buttons && (
78-
<div className={tw('flex justify-center gap-2 pt-8', size === 'sm' && 'pt-5')}>
78+
<div
79+
className={tw(
80+
'flex flex-col md:flex-row justify-center gap-2 pt-8',
81+
size === 'sm' && 'pt-5'
82+
)}
83+
>
7984
{buttons}
8085
</div>
8186
)}

0 commit comments

Comments
 (0)