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.
This commit is contained in:
@@ -22,6 +22,7 @@ interface StepperProps {
|
||||
onStepChange?: (step: number) => void;
|
||||
onSubmit?: () => void;
|
||||
isSubmitting?: boolean;
|
||||
nextDisabled?: boolean;
|
||||
}
|
||||
|
||||
const Stepper: React.FC<StepperProps> = ({
|
||||
@@ -30,6 +31,7 @@ const Stepper: React.FC<StepperProps> = ({
|
||||
onStepChange,
|
||||
onSubmit,
|
||||
isSubmitting = false,
|
||||
nextDisabled = false,
|
||||
}) => {
|
||||
const [internalStep, setInternalStep] = useState(0);
|
||||
const currentStep =
|
||||
@@ -213,6 +215,7 @@ const Stepper: React.FC<StepperProps> = ({
|
||||
};
|
||||
|
||||
const nextStep = () => {
|
||||
if (nextDisabled) return;
|
||||
if (currentStep === steps.length - 1) {
|
||||
if (onSubmit) onSubmit();
|
||||
} else if (currentStep < steps.length - 1) {
|
||||
@@ -425,20 +428,20 @@ const Stepper: React.FC<StepperProps> = ({
|
||||
onClick={nextStep}
|
||||
onMouseEnter={() => handleButtonHover(nextBtnRef.current, true)}
|
||||
onMouseLeave={() => handleButtonHover(nextBtnRef.current, false)}
|
||||
disabled={isSubmitting}
|
||||
disabled={isSubmitting || nextDisabled}
|
||||
className={`group relative inline-flex items-center gap-2 overflow-hidden rounded-xl px-6 py-2.5 text-sm font-semibold text-white transition-all ${
|
||||
isSubmitting
|
||||
isSubmitting || nextDisabled
|
||||
? "cursor-not-allowed bg-gray-4"
|
||||
: "bg-gradient-to-r from-primary via-blue to-primary bg-[length:200%_100%] shadow-lg shadow-primary/30 hover:shadow-primary/50"
|
||||
}`}
|
||||
style={
|
||||
!isSubmitting
|
||||
!isSubmitting && !nextDisabled
|
||||
? { animation: "stepperShimmer 3s linear infinite" }
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{/* Glow halo for submit */}
|
||||
{isLastStep && !isSubmitting && (
|
||||
{isLastStep && !isSubmitting && !nextDisabled && (
|
||||
<span
|
||||
ref={submitGlowRef}
|
||||
aria-hidden
|
||||
|
||||
Reference in New Issue
Block a user