-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add modal
prop to Dialog
#907
Conversation
@@ -14,16 +15,23 @@ import type { PanelProps } from '../layout/Panel'; | |||
type ComponentProps = { | |||
/** | |||
* Dialog _should_ be provided with a close handler. We have a few edge use | |||
* cases, however, in which we need to render a "non-closeable" modal. | |||
* cases, however, in which we need to render a "non-closeable" modal dialog. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix requested in last PR.
/** | ||
* Make this Dialog modal. Modal dialogs are: | ||
* - Rendered with a full-screen overlay backdrop | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment list will get longer and be adjusted as more implementation is done...
{ | ||
// Maximum width and height should not exceed 90vw/h | ||
'max-w-[90vw] max-h-[90vh]': modal, | ||
// Overlay sets up a flex layout centered on both axes. For taller | ||
// viewports, remove this modal container from the flex flow with | ||
// fixed positioning and position it 10vh from the top of the | ||
// viewport. This feels more balanced on taller screens. Ensure an | ||
// equal 10vh gap at the bottom of the screen by adjusting max-height | ||
// to `80vh`. | ||
'tall:fixed tall:max-h-[80vh] tall:top-[10vh]': modal, | ||
}, | ||
{ | ||
// Max-width rules will ensure actual width never exceeds 90vw | ||
'w-[30rem]': width === 'sm', | ||
'w-[36rem]': width === 'md', // default | ||
'w-[42rem]': width === 'lg', | ||
'w-[30rem]': modal && width === 'sm', | ||
'w-[36rem]': modal && width === 'md', // default | ||
'w-[42rem]': modal && width === 'lg', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This application of sizing styles will be refined as implementation continues, with the introduction of some of the customization controls presented last week. But for now: Only assert size and positioning for modal Dialogs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
This PR starts the division of
Dialog
into modal and non-modal sub-variants. It is possible that one day we will peel this into two components, but for now, one component that can have modal or non-modal behaviors.More behavior differentiation will be applied to modal vs. non-modal Dialogs, but for now, modal Dialogs get a full-screen backdrop Overlay, sizing and positioning, while non-modal Dialogs do not. A modal example has been added to the
Dialog
page.I've also added some next-step TODOs here on
Dialog
's pattern-library page to sketch out where this is going next.Next step: some hooks to handle events that should close modal
Dialog
s.Part of #77