diff --git a/components/ProfileCard/index.tsx b/components/ProfileCard/index.tsx index 23e9610..c9336bf 100644 --- a/components/ProfileCard/index.tsx +++ b/components/ProfileCard/index.tsx @@ -1,5 +1,6 @@ import React, { useState } from 'react'; import { Nav, Textarea } from '@/components/index.tsx'; +import EditProfile from '@/pages/profile/editProfile'; import { useForm } from 'react-hook-form'; import MyPosting from '@/public/icons/myPosting.svg'; import ChangePassword from '@/public/icons/Password.svg'; @@ -41,7 +42,7 @@ export default function ProfileCard({ name, age, gender, imageSrc }: ProfileCard custom: true, customHeader: true, }, - children:
hi
, + children: , }); } diff --git a/pages/profile/editProfile.tsx b/pages/profile/editProfile.tsx new file mode 100644 index 0000000..cc5043e --- /dev/null +++ b/pages/profile/editProfile.tsx @@ -0,0 +1,173 @@ +import React, { useState } from 'react'; +import { FieldError, useForm as UseForm } from 'react-hook-form'; +import useModal from '@/hooks/useModal.ts'; +import { isValidEmail } from '@/utils/validCheck.ts'; +import { + Textarea, + Button, + Input, +} from '@/components/index.tsx'; +import { FieldValues, SubmitHandler } from 'react-hook-form'; +import Calendar from '@/components/Calendar/Calendar.tsx'; + +import ProfileCamera from '@/public/icons/profileCamera.svg'; + +interface ProfileProps { + name?: string; + age?: number; + gender?: 'Male' | 'Female'; + imageSrc : string; +}; + +export default function EditProfile({ imageSrc }: ProfileProps) { + const { openModal, closeModal } = useModal(); + const subHeader = 'font-pretendard font-semibold text-[16px]'; + const { + register, + watch, + handleSubmit, + formState: { errors }, + } = UseForm({ mode: 'onChange' }); + const [buttonState, setButtonState] = useState('Male'); + const [isCalendarShow, setCalendarShow] = useState(false); + + const onSubmit: SubmitHandler = (data) => { + openModal({ + props: { + title: 'My Postings', + size: 'full', + custom: true, + customHeader: true, + }, + children: <>hi, + }); + }; + + const handleCalendarShow = (isShow: boolean) => { + setCalendarShow(isShow); + } + + const isPostingComplete = () => { + return true; + } + + const handleButtonClick = (value: string) => { + setButtonState(value); + }; + + const getButtonColor = (value: string) => { + return buttonState === value ? 'r1' : 'outlined'; + }; + + const genderButtons = [ + { label: 'Male'}, + { label: 'Female'}, + { label: 'Others'} + ]; + + return ( +
+
+
+
+
+ {`${name}'s +
+
+ +
+
+
+ +
+
Email
+
+
+ { + return isValidEmail(value, `Invalid email`); + }, + })} + error={errors.email as FieldError} + /> +
+
+
+
Name
+
+
+ { + return true; + }, + })} + /> +
+
+ { + return true; + }, + })} + /> +
+
+
+
Gender
+
+
+
+ {genderButtons.map( (button,index) => ( +
+ +
+ ))} +
+
+
+
Date of birth
+
+
+ +
+
+
About you
+
+
+