-
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.
Merge pull request #29 from youngwan2/signin
feature/회원가입 시 이용약관 및 개인정보처리 동의 기능 추가
- Loading branch information
Showing
20 changed files
with
434 additions
and
186 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
"use client" | ||
|
||
import BackMoveButton from "@/components/UI/common/BackMoveButton"; | ||
import PolicyTaps from "@/components/UI/policy/PolicyTaps"; | ||
import PrivacyPolicy from "@/components/UI/policy/PrivacyPolicy"; | ||
import PrivacyPolicyConsent from "@/components/UI/policy/PrivatePolicyConsent"; | ||
import TermsConditions from "@/components/UI/policy/TermsConditions"; | ||
import { useState } from "react"; | ||
import { usePolicyTaps } from "@/store/store"; | ||
|
||
export default function PolicyPage(){ | ||
|
||
const [tapNum, setTapNum] = useState(0) | ||
const tapNum = usePolicyTaps((state)=> state.tapNum) | ||
const setTapNum = usePolicyTaps((state)=> state.setTapNum) | ||
|
||
function onClickChangeTap(num:number){ | ||
setTapNum(num) | ||
} | ||
|
||
return( | ||
<> | ||
<BackMoveButton/> | ||
<PolicyTaps tapNum ={tapNum} onClickChangeTap={onClickChangeTap}/> | ||
{tapNum === 0 && <TermsConditions/> } | ||
{tapNum === 1 && <PrivacyPolicy/> } | ||
{tapNum === 2 && <PrivacyPolicyConsent/> } | ||
</> | ||
) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import type { ConsentsType } from "@/types/items.types" | ||
import { ChangeEvent, MouseEvent, useState } from "react" | ||
import PolicyModal from "./PolicyModal" | ||
import { toast } from "react-toastify" | ||
import { createPortal } from "react-dom" | ||
|
||
interface ProsType { | ||
consents: ConsentsType | ||
setConsents: ({ }: any) => void | ||
} | ||
|
||
const checkBoxStyle = ` | ||
before:absolute before:top-[55%] before:translate-y-[-45%] before:left-[50%] before:translate-x-[-50%] | ||
relative hover:cursor-pointer shadow-[0_0_0_1px_gray] w-[18px] h-[18px] inline-block transition-all | ||
` | ||
|
||
const consentItems = [ | ||
{ id: 'all', label: '전체동의' }, | ||
{ id: 'term', label: '이용약관(필수)', href: '/policy' }, | ||
{ id: 'private', label: '개인정보 이용 및 수집 동의(필수)', href: '/policy' }, | ||
{ id: 'child', label: '만 14세 이상(필수)' }, | ||
{ id: 'event', label: '이벤트 등의 프로모션 메일 수신 동의' } | ||
]; | ||
|
||
export default function Consent({ setConsents, consents }: ProsType) { | ||
|
||
const [isOpenModal, setIsOpenModal] = useState({ term: false, private: false }) | ||
|
||
function openModal(target: string) { | ||
target === 'term' && setIsOpenModal({ ...isOpenModal, term: !isOpenModal.term }) | ||
target === 'private' && setIsOpenModal({ ...isOpenModal, private: !isOpenModal.private }) | ||
} | ||
|
||
function onClickAgreement(target: string) { | ||
openModal(target) | ||
target === 'term' && setConsents({ ...consents, term: true }) | ||
target === 'private' && setConsents({ ...consents, private: true }) | ||
|
||
} | ||
|
||
function onChangeCheck(e: ChangeEvent<HTMLElement> | MouseEvent<HTMLSpanElement>) { | ||
const type = e.currentTarget.dataset.id | ||
const { all, term, private: privateConsent, child, event } = consents | ||
if (type === 'all') return setConsents({ all: !all, term: !all, private: !all, child: !all, event: !all }) | ||
if (type === 'term') return setConsents({ ...consents, term: !term }) | ||
if (type === 'private') return setConsents({ ...consents, private: !privateConsent }) | ||
if (type === 'child') return setConsents({ ...consents, child: !child }) | ||
if (type === 'event') setConsents({ ...consents, event: !event }) | ||
} | ||
|
||
return ( | ||
<> | ||
<article aria-label="약관동의 체크박스" className="max-w-[450px] w-full mx-auto bg-white rounded-[2px] p-[10px] mt-[2em] shadow-[inset_3px_3px_5px_rgba(0,0,0,0.5)] text-gray-700"> | ||
{consentItems.map(item => ( | ||
<div key={item.id} className="py-[0.5em] flex items-center"> | ||
<label className="w-[300px] inline-block font-bold"> {item.id === 'term' || item.id === 'private' ? <span onClick={() => openModal(item.id)} className="text-black shadow-[inset_0_-1px_0_0_green] hover:cursor-pointer">{item.label}</span> : item.label} </label> | ||
<input onChange={onChangeCheck} className="hidden" checked={consents[item.id]} data-id={item.id} type="checkbox" name={`${item.id}-consent`} /> | ||
<span | ||
onClick={onChangeCheck} | ||
data-id={item.id} | ||
className={`${consents[item.id] ? 'before:content-["✔"] before:opacity-100 text-green-600 ' : 'before:content-[""] before:opacity-0'} ${checkBoxStyle}`} | ||
></span> | ||
</div> | ||
))} | ||
</article> | ||
{createPortal( | ||
<PolicyModal isOpenModal={isOpenModal} onClickAgreement={onClickAgreement} />, document.body | ||
)} | ||
</> | ||
); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import PrivacyPolicyConsent from "../../policy/PrivatePolicyConsent"; | ||
import TermsConditions from "../../policy/TermsConditions"; | ||
|
||
interface PropsType { | ||
isOpenModal: { | ||
term: boolean | ||
private: boolean | ||
} | ||
onClickAgreement: (target: string) => void | ||
} | ||
|
||
|
||
export default function PolicyModal({ isOpenModal, onClickAgreement }: PropsType) { | ||
return ( | ||
<> | ||
{ | ||
isOpenModal.term && <div className="rounded-[10px] fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] max-h-[85vh] w-[90%] overflow-auto bg-white shadow-[0_0_20px_10px_rgba(100,100,125,0.3)] z-[10000]"> | ||
<h2 className="text-[1.25em] absolute top-[0.5em] left-[0.5em] font-bold font-sans">서비스 이용약관</h2> | ||
<TermsConditions /> | ||
<button onClick={() => onClickAgreement('term')} className="w-full bg-[tomato] text-white p-[5px] hover:bg-[#f0735c]">확인</button> | ||
<button onClick={() => onClickAgreement('private')} className="w-full bg-[#ffffff] text-black text-[0.95em] p-[5px] font-sans">※ 거부시 체크박스를 직접 해제 해주시면 됩니다. 단, 회원가입을 더 이상 진행할 수 없습니다.</button> | ||
</div> | ||
} | ||
{ | ||
isOpenModal.private && <div className="rounded-[10px] fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] max-h-[85vh] w-[90%] overflow-auto bg-white shadow-[0_0_20px_10px_rgba(100,100,125,0.3)] z-[10000]"> | ||
<h2 className="text-[1.25em] absolute top-[0.5em] left-[0.5em] font-bold font-sans">개인정보 수집 및 이용 동의서</h2> | ||
<PrivacyPolicyConsent /> | ||
<button onClick={() => onClickAgreement('private')} className="w-full bg-[tomato] text-white p-[5px] hover:bg-[#f0735c]">확인</button> | ||
<button onClick={() => onClickAgreement('private')} className="w-full bg-[#ffffff] text-black text-[0.95em] p-[5px] font-sans">※ 거부시 확인 후 체크박스를 직접 해제 해주시면 됩니다. 단, 회원가입을 더 이상 진행할 수 없습니다.</button> | ||
</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
Oops, something went wrong.