Files
tm_panel/src/app/marketing/_components/FeaturesStep.tsx
T
AmirReza Jamali 88f223bf08 chore(env): update application version to 2.2.8 in production environment
feat(marketing): enhance step components with validity reporting

- Added onValidityChange prop to multiple step components (BenefitsStep, ChallengesStep, ChartStep, ContactsStep, FeaturesStep, FooterStep, HeroStep) to handle form validity.
- Updated respective presenter hooks to utilize the new onValidityChange functionality for real-time validity reporting.
- Enhanced MarketingForm to manage step validity and disable the next button based on current step validity.
2026-06-06 15:39:03 +03:30

47 lines
1.1 KiB
TypeScript

"use client";
import { forwardRef } from "react";
import SectionStep from "./SectionStep";
import useFeaturesStepPresenter, {
IFeaturesStepFields,
} from "./useFeaturesStepPresenter";
interface FeaturesStepProps {
initialData?: IFeaturesStepFields;
onValidityChange?: (valid: boolean) => void;
}
const FeaturesStep = forwardRef<unknown, FeaturesStepProps>(
({ initialData, onValidityChange }, ref) => {
const {
errors,
handleSubmit,
onSubmit,
register,
fields,
append,
remove,
control,
} = useFeaturesStepPresenter(initialData, ref, onValidityChange);
return (
<SectionStep<IFeaturesStepFields>
title="Features"
fields={fields}
handleSubmit={handleSubmit}
onSubmit={onSubmit}
register={register}
errors={errors}
append={append}
remove={remove}
control={control}
fieldName="cards"
defaultValues={{ icon: "", title: "", description: "" }}
/>
);
},
);
FeaturesStep.displayName = "FeaturesStep";
export default FeaturesStep;