Debian Codegraph @

node/@patternfly/react-core/src/components/Wizard/examples/WizardWithCustomNav.tsx

raw
1 import {
2 Wizard,
3 WizardStep,
4 WizardStepType,
5 CustomWizardNavFunction,
6 WizardNav,
7 WizardNavItem
8 } from '@patternfly/react-core';
9
10 export const WizardWithCustomNav: React.FunctionComponent = () => {
11 const nav: CustomWizardNavFunction = (
12 isExpanded: boolean,
13 steps: WizardStepType[],
14 activeStep: WizardStepType,
15 goToStepByIndex: (index: number) => void
16 ) => (
17 <WizardNav isExpanded={isExpanded}>
18 {steps.map((step) => (
19 <WizardNavItem
20 key={step.id}
21 id={step.id}
22 content={step.name}
23 isCurrent={activeStep.id === step.id}
24 isDisabled={step.isDisabled}
25 stepIndex={step.index}
26 onClick={() => goToStepByIndex(step.index)}
27 />
28 ))}
29 </WizardNav>
30 );
31
32 return (
33 <Wizard height={400} nav={nav}>
34 <WizardStep name="Step 1" id="custom-nav-first-step">
35 Did you say...custom nav?
36 </WizardStep>
37 <WizardStep name="Step 2" id="custom-nav-second-step">
38 Oh, you didn't?
39 </WizardStep>
40 <WizardStep name="Review" id="custom-nav-review-step" footer={{ nextButtonText: 'Wrap it up' }}>
41 Well, this is awkward.
42 </WizardStep>
43 </Wizard>
44 );
45 };