From fd879c33df402bdfaaa139a429c06e1cca709d01 Mon Sep 17 00:00:00 2001 From: SeonghunYang Date: Fri, 29 Nov 2024 08:38:09 +0000 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20funnel=EC=9D=98=20=EB=A0=8C=EB=8D=94?= =?UTF-8?q?=EB=A7=81=20=EB=B0=A9=EC=8B=9D=EC=9D=84=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=ED=95=98=EC=97=AC=20=EC=9E=90=EC=97=B0=EC=8A=A4=EB=9F=BD?= =?UTF-8?q?=EA=B2=8C=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/hooks/useFunnel.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/hooks/useFunnel.tsx b/app/hooks/useFunnel.tsx index 6e7e4c4c..7b0b4a2e 100644 --- a/app/hooks/useFunnel.tsx +++ b/app/hooks/useFunnel.tsx @@ -15,7 +15,9 @@ export default function useFunnel( const stepQueryKey = options?.stepQueryKey ?? DEFAULT_STEP_QUERY_KEY; - const step = searchParams.get(stepQueryKey) as Steps | undefined; + const stepQueryValue = searchParams.get(stepQueryKey) as Steps | null; + + const step = (stepQueryValue ?? defaultStep) as Steps; const createUrl = useCallback( (step: Steps) => { @@ -36,10 +38,10 @@ export default function useFunnel( ); useEffect(() => { - if (!step) { + if (!stepQueryValue) { router.replace(createUrl(defaultStep)); } - }, [defaultStep, step, setStep]); + }, [defaultStep, stepQueryValue, setStep]); const Step = ({ name, children }: React.PropsWithChildren<{ name: Steps }>) => { return <>{children}; From 25cb5144659a04540fa96e89d100dbf6fba016ea Mon Sep 17 00:00:00 2001 From: SeonghunYang Date: Fri, 29 Nov 2024 09:12:04 +0000 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20form=20input=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=EC=97=90=20autoFocus=20=EC=86=8D=EC=84=B1=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ui/view/molecule/form/form-number-input.tsx | 11 ++++------- app/ui/view/molecule/form/form-password-input.tsx | 11 ++++------- app/ui/view/molecule/form/form-root.tsx | 9 +++++++++ app/ui/view/molecule/form/form-select.tsx | 10 ++++------ app/ui/view/molecule/form/form-text-input.tsx | 10 ++++------ 5 files changed, 25 insertions(+), 26 deletions(-) diff --git a/app/ui/view/molecule/form/form-number-input.tsx b/app/ui/view/molecule/form/form-number-input.tsx index 2624a85f..ac463324 100644 --- a/app/ui/view/molecule/form/form-number-input.tsx +++ b/app/ui/view/molecule/form/form-number-input.tsx @@ -1,16 +1,12 @@ import TextInput from '../../atom/text-input/text-input'; +import { FormInputProps } from './form-root'; import { FormContext } from './form.context'; import { useContext } from 'react'; import { useFormStatus } from 'react-dom'; -interface FormNumberInputProps { - label: string; - id: string; - placeholder: string; - required?: boolean; -} +interface FormNumberInputProps extends FormInputProps {} -export function FormNumberInput({ label, id, placeholder, required = false }: FormNumberInputProps) { +export function FormNumberInput({ label, id, placeholder, autoFocus, required = false }: FormNumberInputProps) { const { errors } = useContext(FormContext); const { pending } = useFormStatus(); @@ -23,6 +19,7 @@ export function FormNumberInput({ label, id, placeholder, required = false }: Fo {label} { if (!React.isValidElement(child) || child.type === FormSubmitButton) return null; if (child.type === FormSubmitButton) return child; + return
{child}
; }); }; diff --git a/app/ui/view/molecule/form/form-select.tsx b/app/ui/view/molecule/form/form-select.tsx index 42d27ac4..a2af7141 100644 --- a/app/ui/view/molecule/form/form-select.tsx +++ b/app/ui/view/molecule/form/form-select.tsx @@ -1,17 +1,14 @@ import Select from '../select'; +import { FormInputProps } from './form-root'; import { FormContext } from './form.context'; import { useContext } from 'react'; import { useFormStatus } from 'react-dom'; -interface FormSelectProps { - label: string; - id: string; +interface FormSelectProps extends FormInputProps { options: { value: string; placeholder: string }[]; - placeholder: string; - required?: boolean; } -export const FormSelect = ({ label, id, options, placeholder, required = true }: FormSelectProps) => { +export const FormSelect = ({ label, id, options, placeholder, autoFocus, required = true }: FormSelectProps) => { const { errors } = useContext(FormContext); const { pending } = useFormStatus(); @@ -24,6 +21,7 @@ export const FormSelect = ({ label, id, options, placeholder, required = true }: {label}