From 37d33e0550a5109b3875f05fc900a998116af8b3 Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Mon, 11 Dec 2023 16:28:04 +0200 Subject: [PATCH 1/4] Components: Remove fixed width for `compact` sized Buttons --- packages/components/src/button/style.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/components/src/button/style.scss b/packages/components/src/button/style.scss index 0af5144d3d4b7f..c37207e20f0b34 100644 --- a/packages/components/src/button/style.scss +++ b/packages/components/src/button/style.scss @@ -270,7 +270,6 @@ &.has-icon:not(.has-text) { padding: 0; - width: $button-size-compact; min-width: $button-size-compact; } } From 4cc9ec42b98b6d9b747dbbc1f667b5a4e6e0d4d4 Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Mon, 11 Dec 2023 16:35:28 +0200 Subject: [PATCH 2/4] update changelog --- packages/components/CHANGELOG.md | 1 + packages/components/src/button/style.scss | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 4114a32f148542..0423a704024a75 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -25,6 +25,7 @@ - `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)). - `SlotFillProvider`: Restore contextual Slot/Fills within SlotFillProvider ([#56779](https://github.com/WordPress/gutenberg/pull/56779)). +- `Button`: Fix logic of `has-text` class addition ([#56949](https://github.com/WordPress/gutenberg/pull/56949)). ### Internal diff --git a/packages/components/src/button/style.scss b/packages/components/src/button/style.scss index c37207e20f0b34..77dd1ff1b18850 100644 --- a/packages/components/src/button/style.scss +++ b/packages/components/src/button/style.scss @@ -282,7 +282,6 @@ &.has-icon:not(.has-text) { padding: 0; - width: $button-size-small; min-width: $button-size-small; } } From 9c5f676eef5f8db613fbf0f5936c43b0b8d3f629 Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Thu, 14 Dec 2023 14:37:05 +0200 Subject: [PATCH 3/4] Fix logic of has-text class addition in Button --- packages/components/src/button/index.tsx | 2 +- packages/components/src/button/style.scss | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/components/src/button/index.tsx b/packages/components/src/button/index.tsx index b14e85fa52f7f6..bd91de2ec2e83e 100644 --- a/packages/components/src/button/index.tsx +++ b/packages/components/src/button/index.tsx @@ -156,7 +156,7 @@ export function UnforwardedButton( 'is-busy': isBusy, 'is-link': variant === 'link', 'is-destructive': isDestructive, - 'has-text': !! icon && hasChildren, + 'has-text': !! icon && ( hasChildren || text ), 'has-icon': !! icon, } ); diff --git a/packages/components/src/button/style.scss b/packages/components/src/button/style.scss index 77dd1ff1b18850..0af5144d3d4b7f 100644 --- a/packages/components/src/button/style.scss +++ b/packages/components/src/button/style.scss @@ -270,6 +270,7 @@ &.has-icon:not(.has-text) { padding: 0; + width: $button-size-compact; min-width: $button-size-compact; } } @@ -282,6 +283,7 @@ &.has-icon:not(.has-text) { padding: 0; + width: $button-size-small; min-width: $button-size-small; } } From 331cdf8a2847e8b4fa810cd8c231136f06eb459a Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Thu, 14 Dec 2023 14:42:14 +0200 Subject: [PATCH 4/4] fix changelog --- packages/components/CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 0423a704024a75..020586947a2f25 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -6,6 +6,10 @@ - `TabPanel`: do not render hidden content ([#57046](https://github.com/WordPress/gutenberg/pull/57046)). +### Bug Fix + +- `Button`: Fix logic of `has-text` class addition ([#56949](https://github.com/WordPress/gutenberg/pull/56949)). + ## 25.14.0 (2023-12-13) ### Enhancements @@ -25,7 +29,6 @@ - `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)). - `SlotFillProvider`: Restore contextual Slot/Fills within SlotFillProvider ([#56779](https://github.com/WordPress/gutenberg/pull/56779)). -- `Button`: Fix logic of `has-text` class addition ([#56949](https://github.com/WordPress/gutenberg/pull/56949)). ### Internal