Skip to content

Commit

Permalink
Add size compact to buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvang21 committed Sep 25, 2024
1 parent 0dde589 commit 3cd42d6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ const CarouselNavigation = ( {
} ) => (
<div className="block-editor-block-pattern-setup__navigation">
<Button
__next40pxDefaultSize
size="compact"
icon={ isRTL() ? chevronRight : chevronLeft }
label={ __( 'Previous pattern' ) }
onClick={ handlePrevious }
disabled={ activeSlide === 0 }
accessibleWhenDisabled
/>
<Button
__next40pxDefaultSize
size="compact"
icon={ isRTL() ? chevronLeft : chevronRight }
label={ __( 'Next pattern' ) }
onClick={ handleNext }
Expand All @@ -66,14 +66,14 @@ const SetupToolbar = ( {
const displayControls = (
<div className="block-editor-block-pattern-setup__display-controls">
<Button
__next40pxDefaultSize
size="compact"
icon={ stretchFullWidth }
label={ __( 'Carousel view' ) }
onClick={ () => setViewMode( VIEWMODES.carousel ) }
isPressed={ isCarouselView }
/>
<Button
__next40pxDefaultSize
size="compact"
icon={ grid }
label={ __( 'Grid view' ) }
onClick={ () => setViewMode( VIEWMODES.grid ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,24 @@ export default function Pagination( {
className="block-editor-patterns__grid-pagination-previous"
>
<Button
__next40pxDefaultSize
variant="tertiary"
onClick={ () => changePage( 1 ) }
disabled={ currentPage === 1 }
aria-label={ __( 'First page' ) }
size="compact"
accessibleWhenDisabled
className="block-editor-patterns__grid-pagination-button"
>
<span>«</span>
</Button>
<Button
__next40pxDefaultSize
variant="tertiary"
onClick={ () => changePage( currentPage - 1 ) }
disabled={ currentPage === 1 }
aria-label={ __( 'Previous page' ) }
size="compact"
accessibleWhenDisabled
className="block-editor-patterns__grid-pagination-button"
>
<span></span>
</Button>
Expand All @@ -72,23 +74,24 @@ export default function Pagination( {
className="block-editor-patterns__grid-pagination-next"
>
<Button
__next40pxDefaultSize
variant="tertiary"
onClick={ () => changePage( currentPage + 1 ) }
disabled={ currentPage === numPages }
aria-label={ __( 'Next page' ) }
size="compact"
accessibleWhenDisabled
className="block-editor-patterns__grid-pagination-button"
>
<span></span>
</Button>
<Button
__next40pxDefaultSize
variant="tertiary"
onClick={ () => changePage( numPages ) }
disabled={ currentPage === numPages }
aria-label={ __( 'Last page' ) }
size="default"
size="compact"
accessibleWhenDisabled
className="block-editor-patterns__grid-pagination-button"
>
<span>»</span>
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,16 @@
}

.show-icon-labels {
.block-editor-patterns__grid-pagination {
.components-button {
width: auto;
// Hide the button icons when labels are set to display...
span {
display: none;
}
// ... and display labels.
// Uses ::before as ::after is already used for active tab styling.
&::before {
content: attr(aria-label);
}
.block-editor-patterns__grid-pagination-button {
width: auto;
// Hide the button icons when labels are set to display...
span {
display: none;
}
// ... and display labels.
// Uses ::before as ::after is already used for active tab styling.
&::before {
content: attr(aria-label);
}
}
}

0 comments on commit 3cd42d6

Please sign in to comment.