-
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
Border panel: Collapse color controls #37425
Conversation
Size Change: +145 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
The border controls are being reimagined entirely in #35602. In the meantime, this PR greatly reduces the size of the panel by collapsing the colors. |
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 works well for me, and is a useful abstraction IMO.
👍
CC: @ciampo if you have any inputs on the rounded corners. |
@jasmussen Well spotted, thank you! The border in the Color panel is applied via the ItemGroup as you mentioned; I pulled out the single item Dropdown for use in the Border panel. I've updated this to refactor out the entire |
17277a8
to
f6cedd8
Compare
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.
Great work @stacimc, nice refactor! Just confirming this is testing well for me too:
✅ Panel matches the screenshots in the PR description
✅ Popover panel and selecting from custom or theme/default colors works well
✅ Border color is correctly reset via the ToolsPanel menu buttons
✅ Verified that the Background, Text, and Link color options in the Colors panel continue to work, and in the process made some fairly hilarious designs 😅
The only issue I ran into was the same as Ramon mentions about the popover position on mobile. That issue exists on trunk
anyway, so this looks good to go to me, and we can always do follow-ups.
Exports the entire ItemGroup so that other panels that want to use the component without the wrapping PanelBody can still support multiple color items, and do not need to manually apply border styles. It continues to work when passed only a single item.
f6cedd8
to
bacd29f
Compare
Rebased to fix merge conflicts. I'm seeing scrollbars on the popover now when the screen height is small, but confirmed this is acknowledged behavior and happens on trunk. |
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.
<ItemGroup | ||
isBordered | ||
isSeparated | ||
className="block-editor-panel-color-gradient-settings__item-group" | ||
> | ||
{ settings.map( ( setting, index ) => ( | ||
<Dropdown | ||
key={ index } | ||
position={ dropdownPosition } | ||
className="block-editor-panel-color-gradient-settings__dropdown" | ||
contentClassName="block-editor-panel-color-gradient-settings__dropdown-content" | ||
renderToggle={ ( { isOpen, onToggle } ) => { | ||
return ( | ||
<Item |
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.
I don't remember if this exact situation already came up in another PR (cc @jasmussen ), but have you tried to have the ItemGroup
inside Dropdown
instead? ie.
<Dropdown>
<ItemGroup>
<Item>
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.
We did try that, yes, and there were ome problems with it. I can't recall them exactly, they are noted somewhere on one of Jorges PRs, and it's something to follow up on, but was acceptable for now. Thanks for looking, and thanks Staci!
Cherry-picked for 5.9.1. |
* Refactor out Dropdown component to be used by border panel * Update label text * Add border-radius * Refactor out the entire ItemGroup instead of just the Dropdown Exports the entire ItemGroup so that other panels that want to use the component without the wrapping PanelBody can still support multiple color items, and do not need to manually apply border styles. It continues to work when passed only a single item.
Description
In #37067 the Color panel was updated to collapse the color elements for a cleaner looking/more compact set of controls. This PR updates the Border panel to do the same for the border color.
To accomplish this, it refactors out the
ColorGradientSettingsDropdown
into its own component so that it can be used by the Border panel.How has this been tested?
I used the Group block to test, since it supports Color and Border with all its properties.
Screenshots
With the popover open:
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).