diff --git a/src/components/ConditionalFormInput/ConditionalFormInput.tsx b/src/components/ConditionalFormInput/ConditionalFormInput.tsx index db6b16b1..3f77ad5d 100644 --- a/src/components/ConditionalFormInput/ConditionalFormInput.tsx +++ b/src/components/ConditionalFormInput/ConditionalFormInput.tsx @@ -1,4 +1,4 @@ -import { useFormContext } from 'react-hook-form'; +import { FieldValues, UseFormRegister } from 'react-hook-form'; import { Modal } from '@components/Modal'; import { Text } from '@components/shared/Text'; @@ -10,55 +10,68 @@ import { } from './ConditionalFormInput.styles'; export type ConditionalFormInputProps = { - title: string; - inputLabel: string; - inputValue?: string; + label: string; + name: string; + register: UseFormRegister; + required?: boolean; + isContainModal?: boolean; isModalOpen?: boolean; - isContainModal: boolean; - isRequired?: boolean; - children?: React.ReactNode; - inputOnChange?: (item: string) => void; closeModal?: () => void; + children?: React.ReactNode; }; export const ConditionalFormInput = ({ - title, + label, + name, + register, + required = false, isContainModal = false, - inputLabel, - inputOnChange, isModalOpen, closeModal, - isRequired, children, ...inputProps }: React.ComponentProps<'input'> & ConditionalFormInputProps) => { - const { register } = useFormContext(); return ( <> - - - {title} - - - inputOnChange && inputOnChange(event.target.value)} - onWheel={(event) => event.currentTarget.blur()} - /> - {isContainModal && ( - - - - {title} + {isContainModal ? ( + <> + + + {label} + + + event.currentTarget.blur()} + readOnly={true} + /> + + + + {label} + + + {children} + + + ) : ( + <> + + + {label} - - {children} - + + event.currentTarget.blur()} + /> + )} ); diff --git a/src/components/TextArea/TextArea.tsx b/src/components/TextArea/TextArea.tsx index 3307edef..0e2527c2 100644 --- a/src/components/TextArea/TextArea.tsx +++ b/src/components/TextArea/TextArea.tsx @@ -1,36 +1,33 @@ -import { useForm } from 'react-hook-form'; +import { FieldValues, UseFormRegister } from 'react-hook-form'; import { Text } from '@components/shared/Text'; import { StyledSubTitle, StyledTextArea } from './TextArea.styles'; type textAreaProps = { - title: string; - inputLabel: string; + label: string; + name: string; defaultValue?: string; - inputOnChange?: (item: string) => void; + register: UseFormRegister; }; export const TextArea = ({ - title, - inputLabel, + label, + register, + name, defaultValue, - inputOnChange, }: textAreaProps) => { - const { register } = useForm(); - return ( <> - {title} + {label} inputOnChange && inputOnChange(event.target.value)} /> ); diff --git a/src/pages/CreateCrewPage/CreateCrewPage.styles.ts b/src/pages/CreateCrewPage/CreateCrewPage.styles.ts index 731ad999..7e0b89fc 100644 --- a/src/pages/CreateCrewPage/CreateCrewPage.styles.ts +++ b/src/pages/CreateCrewPage/CreateCrewPage.styles.ts @@ -25,6 +25,21 @@ export const StyledCreateForm = styled.form` gap: 4px; `; +export const StyledSubTitle = styled.div` + margin-bottom: 8px; +`; + +export const StyledInput = styled.input<{ height?: number | string }>` + padding-left: 10px; + width: 100%; + height: 30px; + height: ${({ height }) => + typeof height === 'number' ? `${height}px` : height}; + border: 1px solid ${({ theme }) => theme.PALETTE.GRAY_300}; + border-radius: 8px; + margin-bottom: 8px; +`; + export const StyledEmptyContainer = styled.div` height: 16px; `; @@ -70,3 +85,12 @@ export const StyledModalContent = styled(Modal.Content)` ${({ theme }) => theme.STYLES.FLEX_CENTER} padding: 30px; `; + +export const StyledTextArea = styled.textarea` + border: 1px solid ${({ theme }) => theme.PALETTE.GRAY_300}; + border-radius: 8px; + width: 100%; + height: 340px; + padding: 8px; + margin-bottom: 16px; +`; diff --git a/src/pages/CreateCrewPage/CreateCrewPage.tsx b/src/pages/CreateCrewPage/CreateCrewPage.tsx index 14c8e333..efc7db94 100644 --- a/src/pages/CreateCrewPage/CreateCrewPage.tsx +++ b/src/pages/CreateCrewPage/CreateCrewPage.tsx @@ -36,8 +36,6 @@ export const CreateCrewPage = () => { methods, locations, onSubmit, - setName, - setContent, handleMaxMemberCount, handleToggleLocation, toggleMaxMemberCountModal, @@ -45,7 +43,6 @@ export const CreateCrewPage = () => { } = useCreateCrewPage(); const { - name, maxMemberCount, selectedLocation, selectedLocations, @@ -58,7 +55,7 @@ export const CreateCrewPage = () => {
- +
@@ -67,24 +64,22 @@ export const CreateCrewPage = () => {
{