import { useState } from 'react'; import { ProgressStepper, ProgressStep, Button, Stack, StackItem } from '@patternfly/react-core'; import accessibilityStyles from '@patternfly/react-styles/css/utilities/Accessibility/accessibility'; export const ProgressStepperBasic: React.FunctionComponent = () => { const [currentStep, setCurrentStep] = useState(0); const steps = [ { title: 'First step', id: 'step1' }, { title: 'Second step', id: 'step2' }, { title: 'Third step', id: 'step3' }, { title: 'Fourth step', id: 'step4' }, { title: 'Fifth step', id: 'step5' } ]; const onStepForward = (_event) => { const next = currentStep + 1; setCurrentStep(next <= 5 ? next : 4); }; const onStepBack = (_event) => { const next = currentStep - 1; setCurrentStep(next > 0 ? next : 0); }; return ( {' '}

{steps[currentStep] && `On ${steps[currentStep].title}.`} {steps[currentStep - 1] && `${steps[currentStep - 1].title} was successful.`}
{steps.map((step, index) => { let variant = 'pending'; let ariaLabel = 'pending step'; if (index < currentStep) { variant = 'success'; ariaLabel = 'completed step, step with success'; } else if (index === currentStep) { variant = 'info'; ariaLabel = 'current step'; } return ( {step.title} ); })}
); };