Skip to content

Commit df5eaed

Browse files
vipul0425vipul0425DaniGuardiolat-hamanojasmussen
authored
Fix: Button Replace remaining 40px default size violations [Block Editor 3] (#65225)
* Fix: Global Styles component to use 40px default size. * Fix: Block variation picket to use 40px default size. * Fix: Block variation transform to use 40px default size. * Fix: color gradient dropdown and block appender button to use 40px default size. * fix: shadowpanel clear button * fix: Button Block appender issues. * fix: Coverts shadow panel Buttons to normal html buttons. * Update packages/block-library/src/group/editor.scss Co-authored-by: Lena Morita <lena@jaguchi.com> * Update packages/block-library/src/group/editor.scss Co-authored-by: Lena Morita <lena@jaguchi.com> * feat: Add tootlip tu shadow button. --------- Co-authored-by: vipul0425 <vipulgupta003@git.wordpress.org> Co-authored-by: DaniGuardiola <daniguardiola@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: jameskoster <jameskoster@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org> Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org>
1 parent cf78cf0 commit df5eaed

File tree

10 files changed

+42
-58
lines changed

10 files changed

+42
-58
lines changed

packages/block-editor/src/components/block-variation-picker/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ function BlockVariationPicker( {
6464
{ allowSkip && (
6565
<div className="block-editor-block-variation-picker__skip">
6666
<Button
67-
// TODO: Switch to `true` (40px size) if possible
68-
__next40pxDefaultSize={ false }
67+
__next40pxDefaultSize
6968
variant="link"
7069
onClick={ () => onSelect() }
7170
>

packages/block-editor/src/components/block-variation-transforms/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ function VariationsButtons( {
3535
</VisuallyHidden>
3636
{ variations.map( ( variation ) => (
3737
<Button
38-
// TODO: Switch to `true` (40px size) if possible
39-
__next40pxDefaultSize={ false }
38+
__next40pxDefaultSize
39+
size="compact"
4040
key={ variation.name }
4141
icon={ <BlockIcon icon={ variation.icon } showColors /> }
4242
isPressed={ selectedValue === variation.name }

packages/block-editor/src/components/button-block-appender/content.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
color: $gray-900;
99
box-shadow: inset 0 0 0 $border-width $gray-900;
1010

11-
// Needs specificity to override button styles.
12-
&.components-button.components-button {
13-
padding: $grid-unit-15;
14-
}
15-
1611
.is-dark-theme & {
1712
color: $light-gray-placeholder;
1813
box-shadow: inset 0 0 0 $border-width $light-gray-placeholder;

packages/block-editor/src/components/button-block-appender/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ function ButtonBlockAppender(
6060

6161
return (
6262
<Button
63-
// TODO: Switch to `true` (40px size) if possible
64-
__next40pxDefaultSize={ false }
63+
__next40pxDefaultSize
6564
ref={ mergedInserterButtonRef }
6665
onFocus={ onFocus }
6766
tabIndex={ tabIndex }

packages/block-editor/src/components/colors-gradients/dropdown.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,7 @@ const renderToggle =
8888
};
8989

9090
return (
91-
<Button
92-
// TODO: Switch to `true` (40px size) if possible
93-
__next40pxDefaultSize={ false }
94-
{ ...toggleProps }
95-
>
91+
<Button __next40pxDefaultSize { ...toggleProps }>
9692
<LabeledColorIndicator
9793
colorValue={ colorValue }
9894
label={ label }

packages/block-editor/src/components/global-styles/color-panel.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,7 @@ function ColorPanelDropdown( {
239239
};
240240

241241
return (
242-
<Button
243-
// TODO: Switch to `true` (40px size) if possible
244-
__next40pxDefaultSize={ false }
245-
{ ...toggleProps }
246-
>
242+
<Button __next40pxDefaultSize { ...toggleProps }>
247243
<LabeledColorIndicators
248244
indicators={ indicators }
249245
label={ label }

packages/block-editor/src/components/global-styles/filters-panel.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ export default function FiltersPanel( {
190190
return (
191191
<ItemGroup isBordered isSeparated>
192192
<Button
193-
// TODO: Switch to `true` (40px size) if possible
194-
__next40pxDefaultSize={ false }
193+
__next40pxDefaultSize
195194
{ ...toggleProps }
196195
>
197196
<LabeledColorIndicator

packages/block-editor/src/components/global-styles/shadow-panel-components.js

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
FlexItem,
1212
Dropdown,
1313
Composite,
14+
Tooltip,
1415
} from '@wordpress/components';
1516
import { useMemo } from '@wordpress/element';
1617
import { shadow as shadowIcon, Icon, check } from '@wordpress/icons';
@@ -42,8 +43,7 @@ export function ShadowPopoverContainer( { shadow, onShadowChange, settings } ) {
4243
/>
4344
<div className="block-editor-global-styles__clear-shadow">
4445
<Button
45-
// TODO: Switch to `true` (40px size) if possible
46-
__next40pxDefaultSize={ false }
46+
__next40pxDefaultSize
4747
variant="tertiary"
4848
onClick={ () => onShadowChange( undefined ) }
4949
>
@@ -80,32 +80,31 @@ export function ShadowPresets( { presets, activeShadow, onSelect } ) {
8080

8181
export function ShadowIndicator( { type, label, isActive, onSelect, shadow } ) {
8282
return (
83-
<Composite.Item
84-
role="option"
85-
aria-label={ label }
86-
aria-selected={ isActive }
87-
className={ clsx( 'block-editor-global-styles__shadow__item', {
88-
'is-active': isActive,
89-
} ) }
90-
render={
91-
<Button
92-
// TODO: Switch to `true` (40px size) if possible
93-
__next40pxDefaultSize={ false }
94-
className={ clsx(
95-
'block-editor-global-styles__shadow-indicator',
96-
{
97-
unset: type === 'unset',
98-
}
99-
) }
100-
onClick={ onSelect }
101-
label={ label }
102-
style={ { boxShadow: shadow } }
103-
showTooltip
104-
>
105-
{ isActive && <Icon icon={ check } /> }
106-
</Button>
107-
}
108-
/>
83+
<Tooltip text={ label }>
84+
<Composite.Item
85+
role="option"
86+
aria-label={ label }
87+
aria-selected={ isActive }
88+
className={ clsx( 'block-editor-global-styles__shadow__item', {
89+
'is-active': isActive,
90+
} ) }
91+
render={
92+
<button
93+
className={ clsx(
94+
'block-editor-global-styles__shadow-indicator',
95+
{
96+
unset: type === 'unset',
97+
}
98+
) }
99+
onClick={ onSelect }
100+
style={ { boxShadow: shadow } }
101+
aria-label={ label }
102+
>
103+
{ isActive && <Icon icon={ check } /> }
104+
</button>
105+
}
106+
/>
107+
</Tooltip>
109108
);
110109
}
111110

@@ -143,11 +142,7 @@ function renderShadowToggle() {
143142
};
144143

145144
return (
146-
<Button
147-
// TODO: Switch to `true` (40px size) if possible
148-
__next40pxDefaultSize={ false }
149-
{ ...toggleProps }
150-
>
145+
<Button __next40pxDefaultSize { ...toggleProps }>
151146
<HStack justify="flex-start">
152147
<Icon
153148
className="block-editor-global-styles__toggle-icon"

packages/block-editor/src/components/global-styles/style.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,15 @@
3737

3838
// These styles are similar to the color palette.
3939
.block-editor-global-styles__shadow-indicator {
40+
appearance: none;
41+
background: none;
4042
color: $gray-800;
4143
border: $gray-200 $border-width solid;
4244
border-radius: $radius-small;
4345
cursor: pointer;
46+
display: inline-flex;
47+
align-items: center;
48+
4449
padding: 0;
4550

4651
height: $button-size-small + 2 * $border-width;

packages/block-library/src/group/editor.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
&::after {
4040
content: "";
4141
display: flex;
42-
flex: 1 0 $grid-unit-60;
42+
flex: 1 0 $button-size-next-default-40px;
4343
pointer-events: none;
44-
min-height: $grid-unit-60 - $border-width - $border-width;
44+
min-height: $button-size-next-default-40px - $border-width - $border-width;
4545
border: $border-width dashed currentColor;
4646
}
4747

0 commit comments

Comments
 (0)