import React from 'react'; import { Button, Flex, FlexItem, Spinner, useWizardContext, Wizard, WizardFooter, WizardFooterWrapper, WizardStep } from '@breakaway/preact-core'; const CustomWizardFooter = () => { const { activeStep, goToNextStep, goToPrevStep, close } = useWizardContext(); return ( ); }; const CustomStepTwoFooter = () => { const { goToNextStep, goToPrevStep, close } = useWizardContext(); const [isLoading, setIsLoading] = React.useState(false); async function onNext() { setIsLoading(true); await new Promise((resolve) => setTimeout(resolve, 2000)); setIsLoading(false); goToNextStep(); } return ( ); }; interface ReviewStepContentProps { isSubmitting: boolean | undefined; } const ReviewStepContent: React.FunctionComponent = ({ isSubmitting }) => { if (isSubmitting === undefined) { return Review step content; } if (isSubmitting) { return ( <>
Calculating wizard score...
); } return <>50 points to Gryffindor!; }; export const WizardWithCustomFooter: React.FunctionComponent = () => { const [isSubmitting, setIsSubmitting] = React.useState(); async function onSubmit(): Promise { setIsSubmitting(true); await new Promise((resolve) => setTimeout(resolve, 5000)); setIsSubmitting(false); } return ( }> Step 1 content }> Step 2 content with a custom async footer ); };