Skip to content

Commit

Permalink
Fix: Button Replace remaining 40px default size violations [Block Edi…
Browse files Browse the repository at this point in the history
…tor 1]. (WordPress#65034)

* feat: Adds 40px height in multiple usage warning.

* feat: Adds 4px size in invalid warining.

* feat: Adds the 40px size in block compare component.

* feat: Makes the __next40pxDefaultSize true in block mover and breadcrumbs.

* fix: block compare default size.

* fix: Invlid warning button size.

* fix: Adds size prop to breadcrumb buttons.

* fix: Updates the snapshot.

* refactor: Removes extra button [custom styles.

---

Co-authored-by: vipul0425 <[email protected]>
Co-authored-by: tyxla <[email protected]>
Co-authored-by: ciampo <[email protected]>
Co-authored-by: jameskoster <[email protected]>
Co-authored-by: jasmussen <[email protected]>
  • Loading branch information
6 people authored Sep 6, 2024
1 parent 7051a8f commit 0fc06de
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@ function BlockBreadcrumb( { rootLabelText } ) {
>
{ hasSelection && (
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
size="small"
className="block-editor-block-breadcrumb__button"
variant="tertiary"
onClick={ () => {
// Find the block editor wrapper for the selected block
const blockEditor = blockRef.current?.closest(
Expand All @@ -96,10 +94,8 @@ function BlockBreadcrumb( { rootLabelText } ) {
{ parents.map( ( parentClientId ) => (
<li key={ parentClientId }>
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
size="small"
className="block-editor-block-breadcrumb__button"
variant="tertiary"
onClick={ () => selectBlock( parentClientId ) }
>
<BlockTitle
Expand Down
31 changes: 1 addition & 30 deletions packages/block-editor/src/components/block-breadcrumb/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,11 @@
}
}

.block-editor-block-breadcrumb__button.components-button {
height: $button-size-small;
line-height: $button-size-small;
padding: 0;
position: relative;

&:hover:not(:disabled) {
text-decoration: underline;
box-shadow: none;
}

&:focus {
box-shadow: none;
}

&:focus::before {
content: "";
display: block;
position: absolute;
border-radius: $radius-small;
top: $border-width;
right: $border-width;
bottom: $border-width;
left: $border-width;

@include button-style__focus();
}
}

.block-editor-block-breadcrumb__current {
cursor: default;
}

.block-editor-block-breadcrumb__button.components-button,
.block-editor-block-breadcrumb__button.block-editor-block-breadcrumb__button,
.block-editor-block-breadcrumb__current {
color: $gray-900;
padding: 0 $grid-unit-10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ export default function BlockView( {

<div className="block-editor-block-compare__action">
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
variant="secondary"
tabIndex="0"
onClick={ action }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ exports[`BlockView should match snapshot 1`] = `
class="block-editor-block-compare__action"
>
<button
class="components-button is-secondary"
class="components-button is-next-40px-default-size is-secondary"
tabindex="0"
type="button"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ export function MultipleUsageWarning( {
<Warning
actions={ [
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
key="find-original"
variant="secondary"
onClick={ () => selectBlock( originalBlockClientId ) }
>
{ __( 'Find original' ) }
</Button>,
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
key="remove"
variant="secondary"
onClick={ () => onReplace( [] ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ export default function BlockInvalidWarning( { clientId } ) {
<Warning
actions={ [
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
key="recover"
onClick={ convert.toRecoveredBlock }
variant="primary"
Expand Down
3 changes: 1 addition & 2 deletions packages/block-editor/src/components/block-mover/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ const BlockMoverButton = forwardRef(
return (
<>
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
ref={ ref }
className={ clsx(
'block-editor-block-mover-button',
Expand Down
3 changes: 1 addition & 2 deletions packages/block-editor/src/components/block-mover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ function BlockMover( {
<BlockDraggable clientIds={ clientIds } fadeWhenDisabled>
{ ( draggableProps ) => (
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
icon={ dragHandle }
className="block-editor-block-mover__drag-handle"
label={ __( 'Drag' ) }
Expand Down

0 comments on commit 0fc06de

Please sign in to comment.