Skip to content

Commit d58e75c

Browse files
authored
Merge pull request #5 from SWYP-mingling/feature/join-meeting-ui
feat: 모임 참가 페이지 UI 구축
2 parents 3deeda3 + 716d354 commit d58e75c

2 files changed

Lines changed: 116 additions & 1 deletion

File tree

app/join/page.tsx

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
'use client';
2+
3+
import { useState } from 'react';
4+
5+
export default function JoinMeetingPage() {
6+
const [name, setName] = useState('');
7+
const [password, setPassword] = useState('');
8+
const [isRemembered, setIsRemembered] = useState(true);
9+
10+
// 이름/비번 유효성 검사 (입력값이 있을 때만 버튼 활성화)
11+
const isFormValid = name.length > 0 && password.length === 4;
12+
13+
const handleSubmit = (e: React.FormEvent) => {
14+
e.preventDefault();
15+
if (!isFormValid) return;
16+
17+
console.log('참여 요청:', { name, password, isRemembered });
18+
};
19+
20+
return (
21+
<div className="flex flex-col items-center justify-center gap-11 bg-white px-5 py-10 md:min-h-[calc(100vh-200px)] md:justify-center">
22+
{/* 타이틀 */}
23+
<h1 className="w-full text-[22px] font-semibold text-black md:max-w-sm">
24+
모임에 참여해 주세요.
25+
</h1>
26+
27+
<form onSubmit={handleSubmit} className="flex w-full flex-col gap-5 md:max-w-sm">
28+
{/* 이름 입력 */}
29+
<div className="flex flex-col gap-2">
30+
<label htmlFor="name" className="text-gray-9 text-sm font-semibold">
31+
이름을 입력해주세요.
32+
</label>
33+
<input
34+
id="name"
35+
type="text"
36+
value={name}
37+
onChange={(e) => setName(e.target.value)}
38+
placeholder="최대 20자 이내로 입력해주세요"
39+
maxLength={20}
40+
className="border-gray-2 placeholder:text-gray-3 text-gray-10 focus:border-blue-5 w-full rounded-sm border py-2 pl-3 text-[15px] focus:bg-white focus:outline-none"
41+
/>
42+
</div>
43+
44+
{/* 비밀번호 입력 */}
45+
<div className="flex flex-col gap-2">
46+
<label htmlFor="password" className="text-gray-9 text-sm font-semibold">
47+
비밀번호를 입력해주세요
48+
</label>
49+
<input
50+
id="password"
51+
type="password"
52+
inputMode="numeric"
53+
value={password}
54+
onChange={(e) => {
55+
// 4자리 숫자만 입력받도록 처리하기
56+
const val = e.target.value.replace(/[^0-9]/g, '');
57+
if (val.length <= 4) setPassword(val);
58+
}}
59+
placeholder="숫자 4자리를 입력해주세요"
60+
className={`border-gray-2 placeholder:text-gray-3 text-gray-10 focus:border-blue-5 w-full rounded-sm border py-2 pl-3 text-center text-[15px] focus:bg-white focus:outline-none ${password ? 'pl-0 text-center' : 'pl-3 text-left'}`}
61+
/>
62+
{/* 체크박스 */}
63+
<div
64+
onClick={() => setIsRemembered(!isRemembered)}
65+
className="flex cursor-pointer items-center gap-2"
66+
>
67+
{/* 체크 아이콘 박스 */}
68+
<div
69+
className={`flex h-5 w-5 items-center justify-center rounded border transition-colors ${
70+
!isRemembered
71+
? 'border-gray-300 bg-white' // 1. 체크가 안 된 경우
72+
: isFormValid
73+
? 'border-blue-500 bg-blue-500' // 2. 체크가 됐고, 이름/비번을 제대로 입력한 경우
74+
: 'border-gray-300 bg-gray-300' // 3. 체크가 됐으나, 입력이 제대로 안 된 경우
75+
}`}
76+
>
77+
{isRemembered && (
78+
<svg
79+
width="8"
80+
height="6"
81+
viewBox="0 0 14 10"
82+
fill="none"
83+
xmlns="http://www.w3.org/2000/svg"
84+
>
85+
<path
86+
d="M1 5L4.5 8.5L13 1"
87+
stroke="white"
88+
strokeWidth="2"
89+
strokeLinecap="round"
90+
strokeLinejoin="round"
91+
/>
92+
</svg>
93+
)}
94+
</div>
95+
<span className={`text-xs font-medium ${isFormValid ? 'text-blue-5' : 'text-gray-5'}`}>
96+
내 정보 기억하기
97+
</span>
98+
</div>
99+
</div>
100+
{/* 하단 버튼 */}
101+
<button
102+
type="submit"
103+
disabled={!isFormValid}
104+
className={`text-gray-2 h-12 w-full rounded-sm py-4 pt-3 pb-2.5 text-lg font-semibold transition-colors md:max-w-sm ${
105+
isFormValid
106+
? 'hover:bg-blue-8 bg-blue-5' // 활성화 상태
107+
: 'bg-gray-4 cursor-not-allowed' // 비활성화 상태
108+
}`}
109+
>
110+
모임 참여하기
111+
</button>
112+
</form>
113+
</div>
114+
);
115+
}

app/share/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default function ShareLinkPage() {
5555
</div>
5656

5757
<Link
58-
href="/"
58+
href="/join"
5959
className="bg-blue-5 hover:bg-blue-8 h-12 w-full rounded-sm py-2.5 pt-3 text-center text-lg font-normal text-white transition-colors md:w-90"
6060
>
6161
내 출발지 등록하기

0 commit comments

Comments
 (0)