Skip to content
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

BorderControl: Fix button styles #56730

Merged
merged 4 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

- `ToggleGroupControl`: react correctly to external controlled updates ([#56678](https://github.com/WordPress/gutenberg/pull/56678)).
- `ToolsPanel`: fix a performance issue ([#56770](https://github.com/WordPress/gutenberg/pull/56770)).
- `BorderControl`: adjust `BorderControlDropdown` Button size to fix misaligned border ([#56730](https://github.com/WordPress/gutenberg/pull/56730)).

## 25.13.0 (2023-11-29)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ const BorderControlDropdown = (
popoverControlsClassName,
resetButtonClassName,
showDropdownHeader,
size,
__unstablePopoverProps,
...otherProps
} = useBorderControlDropdown( props );
Expand Down Expand Up @@ -178,6 +179,7 @@ const BorderControlDropdown = (
tooltipPosition={ dropdownPosition }
label={ __( 'Border color and style picker' ) }
showTooltip={ true }
__next40pxDefaultSize={ size === '__unstable-large' ? true : false }
>
<span className={ indicatorWrapperClassName }>
<ColorIndicator
Expand All @@ -198,7 +200,7 @@ const BorderControlDropdown = (
<HStack>
<StyledLabel>{ __( 'Border color' ) }</StyledLabel>
<Button
isSmall
size="small"
label={ __( 'Close border color' ) }
icon={ closeSmall }
onClick={ onClose }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export function useBorderControlDropdown(
// Generate class names.
const cx = useCx();
const classes = useMemo( () => {
return cx( styles.borderControlDropdown( size ), className );
}, [ className, cx, size ] );
return cx( styles.borderControlDropdown, className );
}, [ className, cx ] );

const indicatorClassName = useMemo( () => {
return cx( styles.borderColorIndicator );
Expand Down Expand Up @@ -95,6 +95,7 @@ export function useBorderControlDropdown(
popoverContentClassName,
popoverControlsClassName,
resetButtonClassName,
size,
__experimentalIsRenderedInSidebar,
};
}
11 changes: 2 additions & 9 deletions packages/components/src/border-control/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,11 @@ export const wrapperHeight = ( size?: 'default' | '__unstable-large' ) => {
`;
};

export const borderControlDropdown = (
size?: 'default' | '__unstable-large'
) => css`
export const borderControlDropdown = css`
background: #fff;

&& > button {
/*
* Override button component styles to fit within BorderControl
* regardless of size.
*/
height: ${ size === '__unstable-large' ? '40px' : '30px' };
width: ${ size === '__unstable-large' ? '40px' : '30px' };
aspect-ratio: 1;
padding: 0;
display: flex;
align-items: center;
Expand Down
Loading