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: always show Reset button #69066

Merged
merged 11 commits into from
Feb 15, 2025
Merged
Show file tree
Hide file tree
Changes from 10 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
3 changes: 3 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

### Enhancement
- `BorderControlDropdown`, `BorderControl`: Reset button is always visible. ([#69066](https://github.com/WordPress/gutenberg/pull/69066)).

### Internal

- `NumberControl`: Fix invalid HTML attributes for infinite bounds ([#69033](https://github.com/WordPress/gutenberg/pull/69033)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,7 @@ const BorderControlDropdown = (
</Button>
);

const renderContent: DropdownComponentProps[ 'renderContent' ] = ( {
onClose,
} ) => (
const renderContent: DropdownComponentProps[ 'renderContent' ] = () => (
<>
<DropdownContentWrapper paddingSize="medium">
<VStack className={ popoverControlsClassName } spacing={ 6 }>
Expand All @@ -224,22 +222,20 @@ const BorderControlDropdown = (
/>
) }
</VStack>
</DropdownContentWrapper>
{ showResetButton && (
<DropdownContentWrapper paddingSize="none">
<div className={ resetButtonClassName }>
<Button
className={ resetButtonClassName }
variant="tertiary"
onClick={ () => {
onReset();
onClose();
} }
disabled={ ! showResetButton }
accessibleWhenDisabled
__next40pxDefaultSize
>
{ __( 'Reset' ) }
</Button>
</DropdownContentWrapper>
) }
</div>
</DropdownContentWrapper>
</>
);

Expand Down
12 changes: 3 additions & 9 deletions packages/components/src/border-control/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,9 @@ export const borderControlPopoverContent = css``;
export const borderColorIndicator = css``;

export const resetButton = css`
justify-content: center;
width: 100%;

/* Override button component styling */
&& {
border-top: ${ CONFIG.borderWidth } solid ${ COLORS.gray[ 400 ] };
border-top-left-radius: 0;
border-top-right-radius: 0;
}
display: flex;
justify-content: flex-end;
margin-top: 12px;
`;

export const borderSlider = () => css`
Expand Down
Loading