import React from 'react'; import { Wizard as WizardDeprecated, WizardStep } from '@breakaway/preact-core/deprecated'; export const WizardIncrementallyEnabledSteps: React.FunctionComponent = () => { const [stepIdReached, setStepIdReached] = React.useState(1); const onNext = ({ id }: WizardStep) => { if (id) { if (typeof id === 'string') { const [, orderIndex] = id.split('-'); id = parseInt(orderIndex); } setStepIdReached(stepIdReached < id ? id : stepIdReached); } }; const closeWizard = () => { // eslint-disable-next-line no-console console.log('close wizard'); }; const steps = [ { id: 'incrementallyEnabled-1', name: 'First step', component:

Step 1 content

}, { id: 'incrementallyEnabled-2', name: 'Second step', component:

Step 2 content

, canJumpTo: stepIdReached >= 2 }, { id: 'incrementallyEnabled-3', name: 'Third step', component:

Step 3 content

, canJumpTo: stepIdReached >= 3 }, { id: 'incrementallyEnabled-4', name: 'Fourth step', component:

Step 4 content

, canJumpTo: stepIdReached >= 4 }, { id: 'incrementallyEnabled-5', name: 'Review', component:

Review step content

, nextButtonText: 'Finish', canJumpTo: stepIdReached >= 5 } ]; const title = 'Incrementally enabled wizard example'; return ( ); };