-
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
DropdownMenu v2: tweak styles, add toolbar-specific styles #51097
Conversation
@@ -4,6 +4,7 @@ export { | |||
} from './context-system-provider'; | |||
export { | |||
contextConnect, | |||
contextConnectWithoutRef, |
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 function was added in #43611 but was never added to the list of exports
8e45f74
to
6e46fca
Compare
ref={ ref } | ||
{ ...props } | ||
/> | ||
<ContextSystemProvider value={ CONTEXT_SYSTEM_VALUE }> |
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 won't have any effect on dropdowns inside Toolbar
just yet, since it's still using the legacy DropdownMenu
component. But it's setting the ground.
Flaky tests detected in 0887983. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5132767678
|
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.
Works well in my testing 👍
Code also looks good 💯 Nice work!
I've left a few questions, nothing blocking though. ✅
@@ -23,6 +24,14 @@ const ITEM_PREFIX_WIDTH = space( 7 ); | |||
const ITEM_PADDING_INLINE_START = space( 2 ); | |||
const ITEM_PADDING_INLINE_END = space( 2.5 ); | |||
|
|||
// TODO: should bring this into the config, and make themeable |
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.
👍
aa9b42f
to
8e711f9
Compare
Size Change: +450 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
Rebased to solve conflicts and include changes from #51046.
Since my understanding is that we want this to look like the current dropdown/popover, I've also added a light gray border to the box shadow (as per the current popover styles). Let me know if that's ok.
I assumed you're referring to the space between submenu popovers.I went ahead and I increased the gap by Let me know if that's what you intended, and if the change looks good. Also, should that gap should be different based on toolbar styles being applied, or should it be the same for all instanced of
That 18x18 icon is just part of the Storybook example, and it's not really related to the I believe it is a decision that I took after implementing the current design specs. The 24x24 version of the WordPress icon felt a bit disproportionate, especially given the space between the icon and the text to its right. I've updated the Storybook example to use a 24x24 icon, let me know what you think.
The check icon is part of the
The helper text is also just part of the Storybook example (and not part of the For ease of review, this is how the Storybook examples look like after the latest set of changes: |
Let's try 4px now, and yes if these new ones can look identical to the existing popovers (seems like that's actually the case), then we can definitely retire the old ones sooner, that'd be nice. So much we can clean up |
Cool, thank you! I'm going to merge this PR, but feel free to open a new issue with more tweaks as you see fit |
…#51097) * Update border radius to 2px * Add toolbar variant styles to top content wrapper * Add toolbar variant styles to sub content wrapper and separators via internal react context * Connect `DropdownMenu` to the components context system * Add temporary Storybook example * Memoize internal context value to avoid extra re-renders * CHANGELOG * Set the toolbar dropdown menu variant in the toolbar component via the context system * Tweak box shadow to match the existing popover * Update icon size and helper text styles in Storybook example * Tweak sub menu offset * add TODO comment
Part of #50459
What?
Refine
DropdownMenu
v2 styles:2px
;Popover
component;variant
that can be set via only by other components in@wordpress/components
, which causes:Note: this PR only focuses on tweaking styles on the
DropdownMenu
component. It does NOT make any changes to theToolbar
andToolbarDropdown
components (and therefore it doesn't impact current dropdowns in the editor). Those changes will be part of a separate PR, and will need some thorough testing around integrating the newDropdownMenu
component in the editor.Why?
Adapting to design specs.
How?
The answer is mostly React Context:
variant
property. This property can only be set using the packages' context system, meaning only other components from@wordpress/components
will be able to trigger this variant. The plan is for this property to be set by theToolbar
componentsDropdownMenu
component, we use another instance of React Content to propagate the receivedvariant
down to all subcomponents. This is to ensure that also the sub-content wrapper and the separator can render accordingly to the chosen variant.I will add more details about the implementation through inline comments.
Testing Instructions
For now, the only way to test the new styles is via Storybook:
2px
for both the content wrappers and each itemToolbar Variant
Storybook example, and notice how the component renders with darker borders (including nested menus and separators).Screenshots or screencast
drodown-menu-toolbar.mp4