Skip to content

Commit 8f7df4c

Browse files
authored
chore(modals): disabled close button example (#4937)
1 parent 640b8a8 commit 8f7df4c

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

ui/components/modals/__tests__/index.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
Footless,
1313
HiddenFooter,
1414
Menu,
15+
DisabledClose,
1516
DeprecatedClose
1617
} from '../base/example';
1718

@@ -43,5 +44,7 @@ describe('Modal', () => {
4344

4445
it('renders a modal that contains a menu', () => matchesMarkup(<Menu />));
4546

47+
it('renders a modal that has a disabled close button', () => matchesMarkup(<DisabledClose />));
48+
4649
it('renders a modal that is using deprecated markup for the close button', () => matchesMarkup(<DeprecatedClose />));
4750
});

ui/components/modals/base/example.jsx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export let Modal = (props) => (
4141
iconClassName="slds-button__icon_large"
4242
symbol="close"
4343
assistiveText="Cancel and close"
44+
disabled={props.closeButtonDisabled}
4445
/>
4546
) : null
4647
}
@@ -51,10 +52,12 @@ export let Modal = (props) => (
5152
Modal.propTypes = {
5253
tabIndex: PropTypes.oneOf(['-1', '0']),
5354
closeButton: PropTypes.bool,
55+
closeButtonDisabled: PropTypes.bool,
5456
};
5557

5658
Modal.defaultProps = {
5759
tabIndex: '-1',
60+
closeButtonDisabled: false,
5861
};
5962

6063
export let ModalHeader = (props) => (
@@ -364,6 +367,36 @@ export const Menu = () => {
364367
);
365368
};
366369

370+
export let DisabledClose = (props) => (
371+
<Backdrop>
372+
<Modal aria-labelledby="modal-heading-01" closeButtonDisabled="true">
373+
<ModalHeader>
374+
<h1 id="modal-heading-01" className="slds-modal__title slds-hyphenate">
375+
Modal header
376+
</h1>
377+
</ModalHeader>
378+
<ModalContent className="slds-p-around_medium">
379+
<p>
380+
Sit nulla est ex deserunt exercitation anim occaecat. Nostrud ullamco
381+
deserunt aute id consequat veniam incididunt duis in sint irure nisi.
382+
Mollit officia cillum Lorem ullamco minim nostrud elit officia tempor
383+
esse quis. Cillum sunt ad dolore quis aute consequat ipsum magna
384+
exercitation reprehenderit magna. Tempor cupidatat consequat elit
385+
dolor adipisicing.
386+
</p>
387+
<p>
388+
Dolor eiusmod sunt ex incididunt cillum quis nostrud velit duis sit
389+
officia. Lorem aliqua enim laboris do dolor eiusmod officia. Mollit
390+
incididunt nisi consectetur esse laborum eiusmod pariatur proident.
391+
Eiusmod et adipisicing culpa deserunt nostrud ad veniam nulla aute
392+
est. Labore esse esse cupidatat amet velit id elit consequat minim
393+
ullamco mollit enim excepteur ea.
394+
</p>
395+
</ModalContent>
396+
</Modal>
397+
</Backdrop>
398+
);
399+
367400
export let DeprecatedClose = (props) => (
368401
<Backdrop>
369402
<Modal aria-labelledby="modal-heading-01">
@@ -497,6 +530,12 @@ export const examples = [
497530
demoStyles: exampleDemoStyles,
498531
element: <Menu />,
499532
},
533+
{
534+
id: 'disabled-close',
535+
label: 'Disabled Close Button (internal only)',
536+
demoStyles: exampleDemoStyles,
537+
element: <DisabledClose />,
538+
},
500539
{
501540
id: 'deprecated-close',
502541
label: 'Deprecated - Old Close Button',

0 commit comments

Comments
 (0)