From 0bcf9ec795a83e416c61a0629260c18186156c66 Mon Sep 17 00:00:00 2001 From: jisu Seo Date: Tue, 9 Jan 2024 23:45:00 +0900 Subject: [PATCH] =?UTF-8?q?Design:=20=ED=9A=8C=EC=9B=90=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=20=EC=9E=85=EB=A0=A5=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=9E=84?= =?UTF-8?q?=EC=8B=9C=20=EB=A7=88=ED=81=AC=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/@types/member.types.ts | 9 +- .../AuthInputBox/AuthInputItem/AuthInput.tsx | 16 +- .../SignupInfo/AuthDropDown/AuthDropDown.tsx | 150 ++++++++++++++---- .../AuthDropDown/AuthDropDownOption.tsx | 89 ++++++++--- src/components/common/icons/Icons.tsx | 37 +++-- src/pages/signup/signupInfo.page.tsx | 30 +++- 6 files changed, 249 insertions(+), 82 deletions(-) diff --git a/src/@types/member.types.ts b/src/@types/member.types.ts index f020057b..1d201829 100644 --- a/src/@types/member.types.ts +++ b/src/@types/member.types.ts @@ -1,6 +1,11 @@ interface MemberRequest { nickname: string; - survey: string; profileImageUrl: string; - password: string; + ageType: string; + genderType: string; +} + +interface SelectOption { + id: string; + value: string; } diff --git a/src/components/Auth/AuthInput/AuthInputBox/AuthInputItem/AuthInput.tsx b/src/components/Auth/AuthInput/AuthInputBox/AuthInputItem/AuthInput.tsx index 0139e453..98c05c63 100644 --- a/src/components/Auth/AuthInput/AuthInputBox/AuthInputItem/AuthInput.tsx +++ b/src/components/Auth/AuthInput/AuthInputBox/AuthInputItem/AuthInput.tsx @@ -3,7 +3,9 @@ import { UseFormRegisterReturn, UseFormResetField } from 'react-hook-form'; interface Props { label: string; - id: 'email' | 'password' | 'passwordCheck'; + subLabel?: string; + required?: boolean; + id: 'email' | 'password' | 'passwordCheck' | 'nickname'; type?: 'text' | 'email' | 'password'; isAutoFocus?: boolean; placeholder: string; @@ -16,6 +18,8 @@ interface Props { const AuthInput = ({ label, + subLabel, + required, id, type = 'text', isAutoFocus = false, @@ -28,9 +32,13 @@ const AuthInput = ({ }: Props) => { return (
- +
+ + {subLabel} + {required && *} +
{ - const [isShow, setIsShow] = useState(false); + // const [isShow, setIsShow] = useState(false); const [isSelected, setIsSelected] = useState(text); return ( -
-

{label}

-
setIsShow(!isShow)} - className={`${ - isShow ? 'h-48' : 'h-12' - } relative w-full overflow-hidden rounded-lg border border-solid border-gray3`}> - { - setIsShow(!isShow); - }} - showDownIcon> - {isSelected} - - {isShow && ( -
    + //
    + //

    {label}

    + //
    setIsShow(!isShow)} + // className={`${ + // isShow ? 'h-48' : 'h-12' + // } relative w-full overflow-hidden rounded-lg border border-solid border-gray3`}> + // { + // setIsShow(!isShow); + // }} + // showDownIcon> + // {isSelected} + // + // {isShow && ( + //
      + // {options.map((option) => ( + //
    • + // { + // setIsSelected(option.value); + // setIsShow(!isShow); + // }}> + // {option.value} + // + //
    • + // ))} + //
    + // )} + //
    + //
    + + setIsSelected('dd')}> + + + + + + + + + {options.map((option) => ( -
  • - { - setIsSelected(option.value); - setIsShow(!isShow); - }}> - {option.value} - -
  • + + {option.value} + ))} -
- )} -
-
+ + + + ); }; export default AuthDropDown; -// ${ -// isShow ? 'h-48' : 'h-12' -// } +{ + /* + + + + + + + + + + + + + + + Fruits + + Apple + Banana + Blueberry + Grapes + Pineapple + + + + + + + Vegetables + + Aubergine + Broccoli + + Carrot + + Courgette + Leek + + + + + + + Meat + + Beef + Chicken + Lamb + Pork + + + + + + + + */ +} diff --git a/src/components/Auth/SignupInfo/AuthDropDown/AuthDropDownOption.tsx b/src/components/Auth/SignupInfo/AuthDropDown/AuthDropDownOption.tsx index 114f978d..a12e5aaf 100644 --- a/src/components/Auth/SignupInfo/AuthDropDown/AuthDropDownOption.tsx +++ b/src/components/Auth/SignupInfo/AuthDropDown/AuthDropDownOption.tsx @@ -1,28 +1,71 @@ -import { DownIcon } from '@components/common/icons/Icons'; +import { CheckIcon, DownIcon } from '@components/common/icons/Icons'; +import * as Select from '@radix-ui/react-select'; +import React, { ReactNode, Ref } from 'react'; -interface Props { - children: string; - clickHandler?: VoidFunction; - showDownIcon?: boolean; +// interface Props { +// children: string; +// clickHandler?: VoidFunction; +// showDownIcon?: boolean; +// } + +// const AuthDropDownOption = ({ +// children, +// clickHandler, +// showDownIcon = false, +// }: Props) => { +// return ( +// +// ); +// }; + +// export default AuthDropDownOption; + +// const AuthDropDownOption = ({ children }: Props) => { +// return ( +// +// {children} +// +// {/* */} +// +// +// ); +// }; + +// export default AuthDropDownOption; + +interface SelectItemProps { + value: string; + children: ReactNode; + className?: string; + disabled?: boolean; } -const AuthDropDownOption = ({ - children, - clickHandler, - showDownIcon = false, -}: Props) => { - return ( - - ); -}; +const AuthDropDownOption = React.forwardRef( + ( + { children, className, ...props }: SelectItemProps, + forwardedRef: Ref, + ) => { + return ( + + {children} + + + + + ); + }, +); export default AuthDropDownOption; diff --git a/src/components/common/icons/Icons.tsx b/src/components/common/icons/Icons.tsx index 06297ad6..eb3136bd 100644 --- a/src/components/common/icons/Icons.tsx +++ b/src/components/common/icons/Icons.tsx @@ -713,25 +713,30 @@ export const SearchIcon: React.FC = ({ ); }; -export const CameraIcon: React.FC = ({ - size = 25, - color = 'black', - fill = 'none', -}) => { +export const CameraIcon: React.FC = () => { return ( - + + + + ); }; diff --git a/src/pages/signup/signupInfo.page.tsx b/src/pages/signup/signupInfo.page.tsx index 5bfeb917..245c9fdf 100644 --- a/src/pages/signup/signupInfo.page.tsx +++ b/src/pages/signup/signupInfo.page.tsx @@ -5,7 +5,7 @@ import { AuthInput, AuthInputWrapper, } from '@components/Auth/AuthInput/AuthInputBox'; -import AuthDropDown from '@components/Auth/SignupInfo/AuthDropDown'; +import AuthDropDown from '@components/Auth/SignupInfo/AuthDropDown/AuthDropDown'; import { BackBox } from '@components/common'; import SubmitBtn from '@components/common/button/SubmitBtn'; import { CameraIcon } from '@components/common/icons/Icons'; @@ -137,12 +137,20 @@ const SignupInfo = () => {
- - + +
- 완료 + 완료
@@ -150,3 +158,17 @@ const SignupInfo = () => { }; export default SignupInfo; + +const genderArr: SelectOption[] = [ + { id: '1', value: '여' }, + { id: '2', value: '남' }, + { id: '3', value: '기타' }, +]; + +const ageArr: SelectOption[] = [ + { id: '1', value: '10대' }, + { id: '2', value: '20대' }, + { id: '3', value: '30대' }, + { id: '4', value: '40대' }, + { id: '5', value: '50대 이상' }, +];