-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
164 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions
9
src/pages/Auth/components/Init/components/MarketingAgreement.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
|
||
export default function MarketingAgreement() { | ||
return ( | ||
<div className="flex h-full flex-col justify-between px-4 py-6"> | ||
MarketingAgreement | ||
</div> | ||
); | ||
} |
9 changes: 9 additions & 0 deletions
9
src/pages/Auth/components/Init/components/PrivacyAgreement.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
|
||
export default function PrivacyAgreement() { | ||
return ( | ||
<div className="flex h-full flex-col justify-between px-4 py-6"> | ||
PrivacyAgreement | ||
</div> | ||
); | ||
} |
9 changes: 9 additions & 0 deletions
9
src/pages/Auth/components/Init/components/ServiceAgreement.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
|
||
export default function ServiceAgreement() { | ||
return ( | ||
<div className="flex h-full flex-col justify-between px-4 py-6"> | ||
ServiceAgreement | ||
</div> | ||
); | ||
} |
6 changes: 3 additions & 3 deletions
6
src/pages/Auth/components/Init/components/initAccessRights.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
src/pages/Auth/components/Init/components/initAgreement.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import React, { useEffect } from 'react'; | ||
import { Link, useNavigate, useOutletContext } from 'react-router-dom'; | ||
import NextButton from '@src/components/NextButton'; | ||
import Checked from '@src/asset/icon/init/checked.svg'; | ||
import Unchecked from '@src/asset/icon/init/unchecked.svg'; | ||
import { InitContextType } from '../index.d'; | ||
|
||
const titles = [ | ||
{ value: '약관에 모두 동의합니다.', link: '' }, | ||
{ value: '(필수) 서비스 이용 약관', link: 'service' }, | ||
{ value: '(필수) 개인정보 처리 방침', link: 'privacy' }, | ||
{ value: '(선택) 마케팅 수신동의', link: 'marketing' }, | ||
]; | ||
|
||
export default function InitAgreement() { | ||
const navigate = useNavigate(); | ||
const { initUser, setInitUser } = useOutletContext<InitContextType>(); | ||
|
||
const agreeData = initUser.agreement.map((item, idx) => ({ | ||
title: titles[idx].value, | ||
link: titles[idx].link, | ||
checked: item, | ||
})); | ||
|
||
const handleCheck = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
const idx = Number(e.target.value); | ||
// toggle | ||
if (idx === 0) | ||
setInitUser((prev) => ({ | ||
...prev, | ||
agreement: new Array(4).fill(!prev.agreement[0]), | ||
})); | ||
else | ||
setInitUser((prev) => { | ||
const newArr = [...prev.agreement]; | ||
newArr[idx] = !newArr[idx]; | ||
return { ...prev, agreement: newArr }; | ||
}); | ||
}; | ||
|
||
useEffect(() => { | ||
let value = false; | ||
if (initUser.agreement[1] && initUser.agreement[2] && initUser.agreement[3]) | ||
value = true; | ||
|
||
setInitUser((prev) => { | ||
const newArr = [...prev.agreement]; | ||
newArr[0] = value; | ||
return { ...prev, agreement: newArr }; | ||
}); | ||
}, [initUser.agreement[1], initUser.agreement[2], initUser.agreement[3]]); | ||
|
||
useEffect(() => { | ||
// 잘못된 요청 방지 | ||
if (!initUser.nickname) navigate('/auth/init'); | ||
}, []); | ||
|
||
return ( | ||
<div className="flex h-full flex-col justify-between px-4 py-6"> | ||
<div> | ||
<div className="pb-12 pt-[33%] text-xl font-semibold"> | ||
지구미에 오신 것을 환영합니다. | ||
</div> | ||
|
||
<div className="flex flex-col gap-4"> | ||
{agreeData.map((item, idx) => ( | ||
<React.Fragment key={item.title}> | ||
<label htmlFor={item.title} className="flex items-center gap-2"> | ||
<img | ||
src={item.checked ? Checked : Unchecked} | ||
alt={`약관${idx}`} | ||
/> | ||
<input | ||
type="checkbox" | ||
checked={item.checked} | ||
value={idx} | ||
onChange={handleCheck} | ||
id={item.title} | ||
className="hidden" | ||
/> | ||
<div> | ||
<span>{item.title}</span> | ||
{idx !== 0 && ( | ||
<Link | ||
className="px-1 py-2 text-sm text-zinc-600 underline" | ||
to={`/auth/init/agreement/${item.link}`} | ||
> | ||
자세히 보기 | ||
</Link> | ||
)} | ||
</div> | ||
</label> | ||
<div className={idx === 0 ? 'h-[1px] bg-zinc-300' : ''} /> | ||
</React.Fragment> | ||
))} | ||
</div> | ||
</div> | ||
|
||
<NextButton | ||
isDisabled={!(initUser.agreement[1] && initUser.agreement[2])} | ||
linkTo="/auth/init/image" | ||
/> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters