Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Modal): update Modal styles to phase 3 spec #16029

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading