forked from patternfly/react-component-groups
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModalDeckExample.tsx
More file actions
78 lines (73 loc) · 1.83 KB
/
ModalDeckExample.tsx
File metadata and controls
78 lines (73 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* eslint-disable no-console */
import { FunctionComponent, useState } from 'react';
import Deck, { DeckButton } from '@patternfly/react-component-groups/dist/dynamic/Deck';
import { ModalDeck } from '@patternfly/react-component-groups/dist/dynamic/ModalDeck';
import { Button, ButtonVariant } from '@patternfly/react-core';
export const ModalDeckExample: FunctionComponent = () => {
const [ isModalOpen, setIsModalOpen ] = useState(false);
const handleClose = () => {
setIsModalOpen(false);
console.log('Modal deck closed');
};
const pages = [
{
content: (
<div>
<h2>Welcome to the Modal Deck</h2>
<p>This deck is displayed in a modal dialog.</p>
</div>
),
buttons: [
{
children: 'Next',
variant: ButtonVariant.primary,
navigation: 'next'
}
] as DeckButton[]
},
{
content: (
<div>
<h2>Page 2</h2>
<p>Navigate through the walkthrough.</p>
</div>
),
buttons: [
{
children: 'Next',
variant: ButtonVariant.primary,
navigation: 'next'
}
] as DeckButton[]
},
{
content: (
<div>
<h2>Final Page</h2>
<p>Click Close to finish.</p>
</div>
),
buttons: [
{
children: 'Close',
variant: ButtonVariant.primary,
navigation: 'close'
}
] as DeckButton[]
}
];
return (
<>
<Button onClick={() => setIsModalOpen(true)}>
Launch modal deck
</Button>
<ModalDeck isOpen={isModalOpen} onClose={handleClose}>
<Deck
pages={pages}
onClose={handleClose}
onPageChange={(index) => console.log('Page changed to:', index + 1)}
/>
</ModalDeck>
</>
);
};