Skip to content

Commit

Permalink
feat(Wizard): replace deprecations in examples (#11298)
Browse files Browse the repository at this point in the history
* feat(Wizard): replace deprecations in examples

* rm modalbody from example and revise modal doc
  • Loading branch information
mfrances17 authored Dec 9, 2024
1 parent ec4e9b9 commit 2de9fea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/react-core/src/components/Modal/examples/Modal.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Basic modals give users the option to either confirm or cancel an action.

To flag an open modal, use the `isOpen` property. To execute a callback when a modal is closed, use the `onClose` property.

A modal must have a `<ModalBody>`, containing the main content of the modal. The `<ModalHeader>` and `<ModalFooter>` components are not required, but are typically used to display the modal title and any button actions, respectively.
The `<ModalBody>`, `<ModalHeader>`, and `<ModalFooter>` components are not required, but are typically used to display the main content of the modal, modal title, and any button actions, respectively.

```ts file="./ModalBasic.tsx"

Expand Down
3 changes: 2 additions & 1 deletion packages/react-core/src/components/Wizard/examples/Wizard.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ DrawerColorVariant,
DrawerHead,
DrawerActions,
DrawerCloseButton,
Modal,
ModalVariant,
Wizard,
WizardFooter,
WizardFooterWrapper,
Expand All @@ -46,7 +48,6 @@ WizardNavItem,
WizardNav,
WizardHeader
} from '@patternfly/react-core';
import { Modal as ModalDeprecated, ModalVariant as ModalVariantDeprecated } from '@patternfly/react-core/deprecated';
import ExternalLinkAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-alt-icon';
import SlackHashIcon from '@patternfly/react-icons/dist/esm/icons/slack-hash-icon';
import CogsIcon from '@patternfly/react-icons/dist/esm/icons/cogs-icon';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import React from 'react';
import { Button, Wizard, WizardStep, WizardHeader } from '@patternfly/react-core';
import { Modal as ModalDeprecated, ModalVariant as ModalVariantDeprecated } from '@patternfly/react-core/deprecated';
import { Button, Modal, ModalVariant, Wizard, WizardHeader, WizardStep } from '@patternfly/react-core';

export const WizardWithinModal = () => {
export const WizardWithinModal: React.FunctionComponent = () => {
const [isModelOpen, setIsModalOpen] = React.useState(false);

return (
<>
<Button onClick={() => setIsModalOpen(true)}>Show Modal</Button>

<ModalDeprecated
<Modal
isOpen={isModelOpen}
showClose={false}
aria-label="Wizard modal"
hasNoBodyWrapper
onEscapePress={() => setIsModalOpen(false)}
variant={ModalVariantDeprecated.medium}
variant={ModalVariant.medium}
>
<Wizard
height={400}
Expand Down Expand Up @@ -43,7 +40,7 @@ export const WizardWithinModal = () => {
Review step content
</WizardStep>
</Wizard>
</ModalDeprecated>
</Modal>
</>
);
};

0 comments on commit 2de9fea

Please sign in to comment.