| 1 |
import { useState } from 'react'; |
| 2 |
import { Button, Modal, ModalVariant, Wizard, WizardHeader, WizardStep } from '@patternfly/react-core'; |
| 3 |
|
| 4 |
export const WizardWithinModal: React.FunctionComponent = () => { |
| 5 |
const [isModelOpen, setIsModalOpen] = useState(false); |
| 6 |
|
| 7 |
return ( |
| 8 |
<> |
| 9 |
<Button onClick={() => setIsModalOpen(true)}>Show Modal</Button> |
| 10 |
|
| 11 |
<Modal |
| 12 |
isOpen={isModelOpen} |
| 13 |
aria-label="Wizard modal" |
| 14 |
onEscapePress={() => setIsModalOpen(false)} |
| 15 |
variant={ModalVariant.medium} |
| 16 |
> |
| 17 |
<Wizard |
| 18 |
height={400} |
| 19 |
onClose={() => setIsModalOpen(false)} |
| 20 |
title="In modal wizard" |
| 21 |
header={ |
| 22 |
<WizardHeader |
| 23 |
onClose={() => setIsModalOpen(false)} |
| 24 |
title="Wizard in modal" |
| 25 |
description="Simple wizard description" |
| 26 |
/> |
| 27 |
} |
| 28 |
> |
| 29 |
<WizardStep name="Step 1" id="in-modal-step-1"> |
| 30 |
Step 1 content |
| 31 |
</WizardStep> |
| 32 |
<WizardStep name="Step 2" id="in-modal-step-2"> |
| 33 |
Step 2 content |
| 34 |
</WizardStep> |
| 35 |
<WizardStep |
| 36 |
name="Review" |
| 37 |
id="in-modal-review-step" |
| 38 |
footer={{ nextButtonText: 'Finish', onNext: () => setIsModalOpen(false) }} |
| 39 |
> |
| 40 |
Review step content |
| 41 |
</WizardStep> |
| 42 |
</Wizard> |
| 43 |
</Modal> |
| 44 |
</> |
| 45 |
); |
| 46 |
}; |