Debian Codegraph @

node/@patternfly/react-core/src/deprecated/components/Modal/examples/ModalWithDescription.tsx

raw
1 import { Fragment, useState } from 'react';
2 import { Button } from '@patternfly/react-core';
3 import { Modal as ModalDeprecated } from '@patternfly/react-core/deprecated';
4
5 export const ModalWithDescription: React.FunctionComponent = () => {
6 const [isModalOpen, setIsModalOpen] = useState(false);
7
8 const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {
9 setIsModalOpen(!isModalOpen);
10 };
11
12 return (
13 <Fragment>
14 <Button variant="primary" onClick={handleModalToggle}>
15 Show modal with description
16 </Button>
17 <ModalDeprecated
18 title="Modal with description"
19 isOpen={isModalOpen}
20 onClose={handleModalToggle}
21 description="A description is used when you want to provide more info about the modal than the title is able to describe. The content in the description is static and will not scroll with the rest of the modal body."
22 actions={[
23 <Button key="confirm" variant="primary" onClick={handleModalToggle}>
24 Confirm
25 </Button>,
26 <Button key="cancel" variant="link" onClick={handleModalToggle}>
27 Cancel
28 </Button>
29 ]}
30 >
31 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
32 magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
33 consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
34 pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est
35 laborum.
36 </ModalDeprecated>
37 </Fragment>
38 );
39 };