-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Font Library: fix modal width on mobile viewport #54518
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,14 @@ | ||
.font-library-modal { | ||
// @todo: If a new prop is added to the Modal component that constrains | ||
// the content width, we should use that prop instead of this style. | ||
// see https://github.com/WordPress/gutenberg/issues/54471. | ||
&.font-library-modal { | ||
|
||
@include break-medium() { | ||
width: 65vw; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we build this into the modal component itself? Mainly, I'd love to avoid as much local software as possible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review!
Does this mean that the width is controlled by JavaScript rather than a stylesheet? If so, I can change the approach to something like this, for example: function FontLibraryModal() {
const isLargeViewport = useViewportMatch( 'medium' );
return (
<Modal
style={ { width: isLargeViewport ? '65vw' : undefined } }
></Modal>
);
} Or do you mean adding width constraints to the base modal component itself? .components-modal__frame {
&.is-full-screen {
@include break-medium() {
width: 65vw;
}
}
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant the latter, that ideally we have an excellent default behavior for the modal component, and we provide overrides on a per-component basis only as an exception. I've heard someone mention an idea to build in "small", "medium", and "large" props into the modal, so that there's some variety in responsive behaviors. But all that boils down to is to have fewer local overrides, ideally. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, that might make sense. Currently, there are only two width variations for the modal component: the default auto-width or the full-width with the However, the Font Manager has only recently been implemented, so as the UI and UX improve, the width may change, or this override style itself may become unnecessary, or may be displayed in full screen. Considering this, I think there is no problem in fixing the bugs and pushing forward with PR for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey all, we've been starting work on this very feature last week — a PR is up, although I haven't had the time to take a look at it just yet. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
} | ||
|
||
.components-modal__header { | ||
border-bottom: none; | ||
} | ||
|
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.
Minor improvement