| 1 |
import { Fragment, useState } from 'react'; |
| 2 |
import { Button } from '@patternfly/react-core'; |
| 3 |
import { Wizard as WizardDeprecated } from '@patternfly/react-core/deprecated'; |
| 4 |
|
| 5 |
export const WizardInModal: React.FunctionComponent = () => { |
| 6 |
const [isOpen, setIsOpen] = useState(false); |
| 7 |
|
| 8 |
const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => { |
| 9 |
setIsOpen(!isOpen); |
| 10 |
}; |
| 11 |
|
| 12 |
const handleWizardToggle = () => { |
| 13 |
setIsOpen(!isOpen); |
| 14 |
}; |
| 15 |
|
| 16 |
const steps = [ |
| 17 |
{ name: 'First step', component: <p>Step 1 content</p> }, |
| 18 |
{ name: 'Second step', component: <p>Step 2 content</p> }, |
| 19 |
{ name: 'Third step', component: <p>Step 3 content</p> }, |
| 20 |
{ name: 'Fourth step', component: <p>Step 4 content</p> }, |
| 21 |
{ name: 'Review', component: <p>Review step content</p>, nextButtonText: 'Finish' } |
| 22 |
]; |
| 23 |
|
| 24 |
const title = 'Wizard in modal example'; |
| 25 |
|
| 26 |
return ( |
| 27 |
<Fragment> |
| 28 |
<Button variant="primary" onClick={handleModalToggle}> |
| 29 |
Show Modal |
| 30 |
</Button> |
| 31 |
<WizardDeprecated |
| 32 |
title={title} |
| 33 |
description="Simple Wizard Description" |
| 34 |
descriptionComponent="div" |
| 35 |
steps={steps} |
| 36 |
onClose={handleWizardToggle} |
| 37 |
isOpen={isOpen} |
| 38 |
/> |
| 39 |
</Fragment> |
| 40 |
); |
| 41 |
}; |