-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix: Button Replace remaining 40px default size violations [Block Editor 3] #65225
Changes from all commits
70ec0f7
631a42c
36d6a70
670cca8
913f90c
e7b1615
bb9545f
c452baa
c8c0e5d
00da47a
9d3d8ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,8 +35,8 @@ function VariationsButtons( { | |
</VisuallyHidden> | ||
{ variations.map( ( variation ) => ( | ||
<Button | ||
// TODO: Switch to `true` (40px size) if possible | ||
__next40pxDefaultSize={ false } | ||
__next40pxDefaultSize | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure about this one. I think it should be more like ToggleGroupControl. IE the outer container is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jameskoster what about just using a ToggleGroupControl? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The visible stroke in the resting state would create additional weight that is probably unwanted in this UI. We have an issue to explore the But until then the simpler approach is probably to just make these buttons There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
size="compact" | ||
key={ variation.name } | ||
icon={ <BlockIcon icon={ variation.icon } showColors /> } | ||
isPressed={ selectedValue === variation.name } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,8 +60,7 @@ function ButtonBlockAppender( | |
|
||
return ( | ||
<Button | ||
// TODO: Switch to `true` (40px size) if possible | ||
__next40pxDefaultSize={ false } | ||
__next40pxDefaultSize | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @jameskoster, I have removed the styles that were overriding the component button padding to fix the small icons. Also fixed the empty placeholder height. |
||
ref={ mergedInserterButtonRef } | ||
onFocus={ onFocus } | ||
tabIndex={ tabIndex } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,11 +88,7 @@ const renderToggle = | |
}; | ||
|
||
return ( | ||
<Button | ||
// TODO: Switch to `true` (40px size) if possible | ||
__next40pxDefaultSize={ false } | ||
{ ...toggleProps } | ||
> | ||
<Button __next40pxDefaultSize { ...toggleProps }> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
<LabeledColorIndicator | ||
colorValue={ colorValue } | ||
label={ label } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -239,11 +239,7 @@ function ColorPanelDropdown( { | |
}; | ||
|
||
return ( | ||
<Button | ||
// TODO: Switch to `true` (40px size) if possible | ||
__next40pxDefaultSize={ false } | ||
{ ...toggleProps } | ||
> | ||
<Button __next40pxDefaultSize { ...toggleProps }> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
<LabeledColorIndicators | ||
indicators={ indicators } | ||
label={ label } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,8 +190,7 @@ export default function FiltersPanel( { | |
return ( | ||
<ItemGroup isBordered isSeparated> | ||
<Button | ||
// TODO: Switch to `true` (40px size) if possible | ||
__next40pxDefaultSize={ false } | ||
__next40pxDefaultSize | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
{ ...toggleProps } | ||
> | ||
<LabeledColorIndicator | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import { | |
FlexItem, | ||
Dropdown, | ||
Composite, | ||
Tooltip, | ||
} from '@wordpress/components'; | ||
import { useMemo } from '@wordpress/element'; | ||
import { shadow as shadowIcon, Icon, check } from '@wordpress/icons'; | ||
|
@@ -42,8 +43,7 @@ export function ShadowPopoverContainer( { shadow, onShadowChange, settings } ) { | |
/> | ||
<div className="block-editor-global-styles__clear-shadow"> | ||
<Button | ||
// TODO: Switch to `true` (40px size) if possible | ||
__next40pxDefaultSize={ false } | ||
__next40pxDefaultSize | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
variant="tertiary" | ||
onClick={ () => onShadowChange( undefined ) } | ||
> | ||
|
@@ -80,32 +80,31 @@ export function ShadowPresets( { presets, activeShadow, onSelect } ) { | |
|
||
export function ShadowIndicator( { type, label, isActive, onSelect, shadow } ) { | ||
return ( | ||
<Composite.Item | ||
role="option" | ||
aria-label={ label } | ||
aria-selected={ isActive } | ||
className={ clsx( 'block-editor-global-styles__shadow__item', { | ||
'is-active': isActive, | ||
} ) } | ||
render={ | ||
<Button | ||
// TODO: Switch to `true` (40px size) if possible | ||
__next40pxDefaultSize={ false } | ||
className={ clsx( | ||
'block-editor-global-styles__shadow-indicator', | ||
{ | ||
unset: type === 'unset', | ||
} | ||
) } | ||
onClick={ onSelect } | ||
label={ label } | ||
style={ { boxShadow: shadow } } | ||
showTooltip | ||
> | ||
{ isActive && <Icon icon={ check } /> } | ||
</Button> | ||
} | ||
/> | ||
<Tooltip text={ label }> | ||
<Composite.Item | ||
role="option" | ||
aria-label={ label } | ||
aria-selected={ isActive } | ||
className={ clsx( 'block-editor-global-styles__shadow__item', { | ||
'is-active': isActive, | ||
} ) } | ||
render={ | ||
<button | ||
className={ clsx( | ||
'block-editor-global-styles__shadow-indicator', | ||
{ | ||
unset: type === 'unset', | ||
} | ||
) } | ||
onClick={ onSelect } | ||
style={ { boxShadow: shadow } } | ||
aria-label={ label } | ||
> | ||
{ isActive && <Icon icon={ check } /> } | ||
</button> | ||
} | ||
/> | ||
</Tooltip> | ||
); | ||
} | ||
|
||
|
@@ -143,11 +142,7 @@ function renderShadowToggle() { | |
}; | ||
|
||
return ( | ||
<Button | ||
// TODO: Switch to `true` (40px size) if possible | ||
__next40pxDefaultSize={ false } | ||
{ ...toggleProps } | ||
> | ||
<Button __next40pxDefaultSize { ...toggleProps }> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
<HStack justify="flex-start"> | ||
<Icon | ||
className="block-editor-global-styles__toggle-icon" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__next40pxDefaultSize
has no effect here because the variation is set tolink
for this button, which overrides the size withheight: auto
.