Skip to content

Commit

Permalink
BorderControl: Make reset to default button only display when required (
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw authored May 9, 2022
1 parent 7b20a16 commit 1dfc080
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Enhancements

- `BorderControl` now only displays the reset button in its popover when selections have already been made. [#40917](https://github.com/WordPress/gutenberg/pull/40917)

## 19.10.0 (2022-05-04)

### Internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ const BorderControlDropdown = (
enableStyle
);

const showResetButton = color || ( style && style !== 'none' );
const dropdownPosition = __experimentalIsRenderedInSidebar
? 'bottom left'
: undefined;
Expand Down Expand Up @@ -220,16 +221,18 @@ const BorderControlDropdown = (
/>
) }
</VStack>
<Button
className={ resetButtonClassName }
variant="tertiary"
onClick={ () => {
onReset();
onClose();
} }
>
{ __( 'Reset to default' ) }
</Button>
{ showResetButton && (
<Button
className={ resetButtonClassName }
variant="tertiary"
onClick={ () => {
onReset();
onClose();
} }
>
{ __( 'Reset to default' ) }
</Button>
) }
</>
);

Expand Down

0 comments on commit 1dfc080

Please sign in to comment.