diff --git a/src/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/Complete.tsx b/src/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/Complete.tsx new file mode 100644 index 00000000..d32f5436 --- /dev/null +++ b/src/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/Complete.tsx @@ -0,0 +1,16 @@ +import { AlertModalProps } from '@/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/ModalContentsAlert'; +import ButtonAlert from '@/pages/HomePage/components/ModalContents/Setting/components/ButtonAlert'; + +const Complete = ({ handleClose, userEmail }: AlertModalProps) => ( +
+
+

{userEmail} 계정이

+

삭제되었습니다.

+ + 확인 + +
+
+); + +export default Complete; diff --git a/src/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/DeleteAccount.tsx b/src/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/DeleteAccount.tsx new file mode 100644 index 00000000..b09a38cb --- /dev/null +++ b/src/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/DeleteAccount.tsx @@ -0,0 +1,62 @@ +import { FormEvent, useRef, useState } from 'react'; + +import IconWarning from '@/shared/assets/svgs/ic_delete_alert.svg?react'; + +import { AlertModalProps } from '@/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/ModalContentsAlert'; +import ButtonAlert from '@/pages/HomePage/components/ModalContents/Setting/components/ButtonAlert'; + +const DeleteAccount = ({ handleClose, userEmail }: AlertModalProps) => { + const inputRef = useRef(null); + const [error, setError] = useState(false); + const handleSubmit = (e: FormEvent) => { + e.preventDefault(); + + if (String(inputRef.current?.value) !== userEmail) { + setError(true); + } + }; + + const handleInputChange = () => { + if (inputRef.current) { + setError(false); + } + }; + return ( +
+
+
+ +
+

{userEmail} 계정이

+

+ 영구적으로 삭제됩니다. 삭제하시겠습니까? +

+

이메일을 입력하여 확인해주세요.

+
+ + {error && ( +
+

계속하려면 “{userEmail}”을(를) 입력하세요.

+
+ )} +
+ + 계정 영구 삭제 + + + 취소하기 + +
+
+
+
+ ); +}; + +export default DeleteAccount; diff --git a/src/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/Logout.tsx b/src/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/Logout.tsx new file mode 100644 index 00000000..472d5942 --- /dev/null +++ b/src/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/Logout.tsx @@ -0,0 +1,22 @@ +import { AlertModalProps } from '@/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/ModalContentsAlert'; +import ButtonAlert from '@/pages/HomePage/components/ModalContents/Setting/components/ButtonAlert'; + +const Logout = ({ handleClose, userEmail }: AlertModalProps) => ( +
+

{userEmail} 계정이

+

+ 본 기기를 포함한 모든 기기에서 로그아웃됩니다. +

+

로그아웃 하시겠습니까?

+
+ + 로그아웃 + + + 취소하기 + +
+
+); + +export default Logout; diff --git a/src/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/ModalContentsAlert.tsx b/src/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/ModalContentsAlert.tsx new file mode 100644 index 00000000..2168ef11 --- /dev/null +++ b/src/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/ModalContentsAlert.tsx @@ -0,0 +1,16 @@ +import Complete from '@/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/Complete'; +import DeleteAccount from '@/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/DeleteAccount'; +import Logout from '@/pages/HomePage/components/ModalContents/Setting/ModalContentsAlert/Logout'; + +export interface AlertModalProps { + handleClose?: () => void; + userEmail?: string; +} + +const ModalContentsAlert = { + Logout: Logout, + DeleteAccount: DeleteAccount, + Complete: Complete, +}; + +export default ModalContentsAlert; diff --git a/src/pages/HomePage/components/ModalContents/Setting/components/ButtonAlert.tsx b/src/pages/HomePage/components/ModalContents/Setting/components/ButtonAlert.tsx new file mode 100644 index 00000000..cb52cd87 --- /dev/null +++ b/src/pages/HomePage/components/ModalContents/Setting/components/ButtonAlert.tsx @@ -0,0 +1,23 @@ +import { ButtonHTMLAttributes, ReactNode } from 'react'; + +interface ButtonAlertProps extends ButtonHTMLAttributes { + variant?: 'primary' | 'danger'; + children: ReactNode; + className?: string; +} + +const ButtonAlert = ({ children, variant = 'primary', className = '', ...props }: ButtonAlertProps) => { + const primaryStyle = 'bg-gray-bg-06 hover:bg-gray-bg-04 active:bg-gray-bg-05'; + const dangerStyle = 'bg-error-01 hover:bg-error-03 active:bg-error-03 active:text-gray-04'; + const buttonStyle = variant === 'primary' ? primaryStyle : dangerStyle; + return ( + + ); +}; + +export default ButtonAlert; diff --git a/src/shared/assets/svgs/ic_delete_alert.svg b/src/shared/assets/svgs/ic_delete_alert.svg new file mode 100644 index 00000000..7d5c6fe5 --- /dev/null +++ b/src/shared/assets/svgs/ic_delete_alert.svg @@ -0,0 +1,4 @@ + + + +