Skip to content

Commit

Permalink
feat(Modal): update Modal styles to phase 3 spec
Browse files Browse the repository at this point in the history
  • Loading branch information
tw15egan committed Mar 21, 2024
1 parent afce28d commit 3fda6bb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 20 deletions.
4 changes: 2 additions & 2 deletions packages/react/src/components/ComposedModal/ComposedModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,11 @@ const ComposedModal = React.forwardRef<HTMLDivElement, ComposedModalProps>(
}
}, [open, selectorPrimaryFocus, isOpen]);

// Slug is always size `lg`
// Slug is always size `sm`
let normalizedSlug;
if (slug && slug['type']?.displayName === 'Slug') {
normalizedSlug = React.cloneElement(slug as React.ReactElement<any>, {
size: 'lg',
size: 'sm',
});
}

Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,11 @@ const Modal = React.forwardRef(function Modal(
};
}, []);

// Slug is always size `lg`
// Slug is always size `sm`
let normalizedSlug;
if (slug && slug['type']?.displayName === 'Slug') {
normalizedSlug = React.cloneElement(slug as React.ReactElement<any>, {
size: 'lg',
size: 'sm',
});
}

Expand Down
11 changes: 1 addition & 10 deletions packages/react/src/components/Slug/Slug-examples.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,12 @@ export const _Combobox = {
export const _ComposedModal = {
args: {
showButtons: true,
hasScrollingContent: false,
},
argTypes: {
slug: {
description:
'**Experimental**: Provide a `Slug` component to be rendered inside the component',
},
hasScrollingContent: {
description: 'Add scrolling content indicator',
},
showButtons: {
description: 'Show or hide the Modal buttons',
},
Expand All @@ -305,7 +301,7 @@ export const _ComposedModal = {
<Button onClick={() => setOpen(true)}>Launch composed modal</Button>
<ComposedModal open={open} onClose={() => setOpen(false)} slug={slug}>
<ModalHeader label="Account resources" title="Add a custom domain" />
<ModalBody hasScrollingContent={args.hasScrollingContent}>
<ModalBody>
<p style={{ marginBottom: '1rem' }}>
Custom domains direct requests for your apps in this Cloud Foundry
organization to a URL that you own. A custom domain can be a
Expand Down Expand Up @@ -428,16 +424,12 @@ export const _FilterableMultiselect = {
export const _Modal = {
args: {
showButtons: true,
hasScrollingContent: false,
},
argTypes: {
slug: {
description:
'**Experimental**: Provide a `Slug` component to be rendered inside the component',
},
hasScrollingContent: {
description: 'Add scrolling content indicator',
},
showButtons: {
description: 'Show or hide the Modal buttons',
},
Expand All @@ -455,7 +447,6 @@ export const _Modal = {
primaryButtonText="Add"
secondaryButtonText="Cancel"
passiveModal={!args.showButtons}
hasScrollingContent={args.hasScrollingContent}
slug={slug}>
<p style={{ marginBottom: '1rem' }}>
Custom domains direct requests for your apps in this Cloud Foundry
Expand Down
8 changes: 2 additions & 6 deletions packages/styles/scss/components/modal/_modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -473,12 +473,6 @@
0 24px 40px -24px $ai-drop-shadow;
}

.#{$prefix}--modal--slug .#{$prefix}--slug {
position: absolute;
inset-block-start: 0;
inset-inline-end: 0;
}

.#{$prefix}--modal--slug
.#{$prefix}--modal-content.#{$prefix}--modal-scroll-content {
mask-image: linear-gradient(
Expand All @@ -500,6 +494,8 @@
.#{$prefix}--modal--slug
.#{$prefix}--modal-container-body
> .#{$prefix}--slug {
position: absolute;
inset-block-start: convert.to-rem(10px);
inset-inline-end: convert.to-rem(48px);
}

Expand Down

0 comments on commit 3fda6bb

Please sign in to comment.