DropdownMenu v2: tweak styles, add toolbar-specific styles#51097
DropdownMenu v2: tweak styles, add toolbar-specific styles#51097
Conversation
There was a problem hiding this comment.
This function was added in #43611 but was never added to the list of exports
8e45f74 to
6e46fca
Compare
There was a problem hiding this comment.
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
|
tyxla
left a comment
There was a problem hiding this comment.
Works well in my testing 👍
Code also looks good 💯 Nice work!
I've left a few questions, nothing blocking though. ✅
…internal react context
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
DropdownMenuv2 styles:2px;Popovercomponent;variantthat can be set via only by other components in@wordpress/components, which causes:Note: this PR only focuses on tweaking styles on the
DropdownMenucomponent. It does NOT make any changes to theToolbarandToolbarDropdowncomponents (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 newDropdownMenucomponent in the editor.Why?
Adapting to design specs.
How?
The answer is mostly React Context:
variantproperty. This property can only be set using the packages' context system, meaning only other components from@wordpress/componentswill be able to trigger this variant. The plan is for this property to be set by theToolbarcomponentsDropdownMenucomponent, we use another instance of React Content to propagate the receivedvariantdown 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:
2pxfor both the content wrappers and each itemToolbar VariantStorybook example, and notice how the component renders with darker borders (including nested menus and separators).Screenshots or screencast
drodown-menu-toolbar.mp4