Skip to content

Commit

Permalink
feat: 모임 생성 퍼널 버튼에 form이 유효하지 않으면 disabled 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
gxxrxn committed Jun 8, 2024
1 parent 5bb9eb6 commit 78d66f7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import BottomActionButton from '@/v1/base/BottomActionButton';
import { TitleField } from './fields';

const EnterTitleStep = ({ onNextStep }: MoveFunnelStepProps) => {
const { handleSubmit } = useFormContext<EnterTitleStepFormValues>();
const {
handleSubmit,
formState: { isValid },
} = useFormContext<EnterTitleStepFormValues>();

useRemoveVerticalScroll();

Expand All @@ -24,6 +27,7 @@ const EnterTitleStep = ({ onNextStep }: MoveFunnelStepProps) => {

<BottomActionButton
type="submit"
disabled={!isValid}
onClick={handleSubmit(() => onNextStep?.())}
>
다음
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export type JoinTypeStepFieldName = keyof SelectJoinTypeStepFormValues;
export type JoinTypeStepFieldProp = { name: JoinTypeStepFieldName };

const SelectJoinTypeStep = ({ onSubmit }: MoveFunnelStepProps) => {
const { handleSubmit } = useFormContext<SelectJoinTypeStepFormValues>();
const {
handleSubmit,
formState: { isValid },
} = useFormContext<SelectJoinTypeStepFormValues>();

return (
<article>
Expand All @@ -31,6 +34,7 @@ const SelectJoinTypeStep = ({ onSubmit }: MoveFunnelStepProps) => {

<BottomActionButton
type="submit"
disabled={!isValid}
onClick={onSubmit && handleSubmit(onSubmit)}
>
독서모임 만들기
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ const SetUpDetailStep = ({
goToSelectBookStep,
onNextStep,
}: SetUpDetailStepProps) => {
const { handleSubmit, getValues } =
useFormContext<SetUpDetailStepFormValues>();
const {
handleSubmit,
getValues,
formState: { isValid },
} = useFormContext<SetUpDetailStepFormValues>();

return (
<article className="flex flex-col gap-[2.5rem] overflow-y-scroll pb-[7rem]">
Expand All @@ -55,6 +58,7 @@ const SetUpDetailStep = ({

<BottomActionButton
type="submit"
disabled={!isValid}
onClick={handleSubmit(() => onNextStep?.())}
>
다음
Expand Down

0 comments on commit 78d66f7

Please sign in to comment.