Skip to content

Commit

Permalink
FontCollection: Update pagination controls (#67143)
Browse files Browse the repository at this point in the history
Co-authored-by: yogeshbhutkar <[email protected]>
Co-authored-by: matiasbenedetto <[email protected]>
Co-authored-by: juanfra <[email protected]>
  • Loading branch information
4 people authored and michalczaplinski committed Dec 5, 2024
1 parent 081db5e commit 46f638e
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ import {
} from '@wordpress/components';
import { debounce } from '@wordpress/compose';
import { sprintf, __, _x, isRTL } from '@wordpress/i18n';
import { moreVertical, chevronLeft, chevronRight } from '@wordpress/icons';
import {
moreVertical,
next,
previous,
chevronLeft,
chevronRight,
} from '@wordpress/icons';

/**
* Internal dependencies
Expand Down Expand Up @@ -486,37 +492,30 @@ function FontCollection( { slug } ) {

{ ! selectedFont && (
<HStack
spacing={ 4 }
justify="center"
expanded={ false }
className="font-library-modal__footer"
justify="end"
spacing={ 6 }
>
<Button
label={ __( 'Previous page' ) }
size="compact"
onClick={ () => setPage( page - 1 ) }
disabled={ page === 1 }
showTooltip
accessibleWhenDisabled
icon={ isRTL() ? chevronRight : chevronLeft }
tooltipPosition="top"
/>
<HStack
justify="flex-start"
expanded={ false }
spacing={ 2 }
spacing={ 1 }
className="font-library-modal__page-selection"
>
{ createInterpolateElement(
sprintf(
// translators: %s: Total number of pages.
// translators: 1: Current page number, 2: Total number of pages.
_x(
'Page <CurrentPageControl /> of %s',
'<div>Page</div>%1$s<div>of %2$s</div>',
'paging'
),
'<CurrentPage />',
totalPages
),
{
CurrentPageControl: (
div: <div aria-hidden />,
CurrentPage: (
<SelectControl
aria-label={ __(
'Current page'
Expand All @@ -535,22 +534,36 @@ function FontCollection( { slug } ) {
parseInt( newPage )
)
}
size="compact"
size="small"
__nextHasNoMarginBottom
variant="minimal"
/>
),
}
) }
</HStack>
<Button
label={ __( 'Next page' ) }
size="compact"
onClick={ () => setPage( page + 1 ) }
disabled={ page === totalPages }
accessibleWhenDisabled
icon={ isRTL() ? chevronLeft : chevronRight }
tooltipPosition="top"
/>
<HStack expanded={ false } spacing={ 1 }>
<Button
onClick={ () => setPage( page - 1 ) }
disabled={ page === 1 }
accessibleWhenDisabled
label={ __( 'Previous page' ) }
icon={ isRTL() ? next : previous }
showTooltip
size="compact"
tooltipPosition="top"
/>
<Button
onClick={ () => setPage( page + 1 ) }
disabled={ page === totalPages }
accessibleWhenDisabled
label={ __( 'Next page' ) }
icon={ isRTL() ? previous : next }
showTooltip
size="compact"
tooltipPosition="top"
/>
</HStack>
</HStack>
) }
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,15 @@ $footer-height: 70px;

.font-library-modal__page-selection {
font-size: 11px;
text-transform: uppercase;
font-weight: 500;
color: $gray-900;
text-transform: uppercase;

@include break-small() {
.components-select-control__input {
font-size: 11px !important;
font-weight: 500;
}
}
}

// TODO: See if this can be removed after https://github.com/WordPress/gutenberg/issues/38730
Expand Down Expand Up @@ -124,7 +130,7 @@ $footer-height: 70px;
white-space: nowrap;
flex-shrink: 0;
transition: opacity 0.3s ease-in-out;
@include reduce-motion("transition");
@include reduce-motion( "transition" );
}
}

Expand All @@ -147,7 +153,6 @@ $footer-height: 70px;
}
}


.font-library-modal__upload-area {
align-items: center;
display: flex;
Expand Down Expand Up @@ -200,7 +205,9 @@ button.font-library-modal__upload-area {
}

.font-library-modal__select-all {
padding: $grid-unit-20 $grid-unit-20 $grid-unit-20 $grid-unit-20 + $border-width;
padding:
$grid-unit-20 $grid-unit-20 $grid-unit-20 $grid-unit-20 +
$border-width;

.components-checkbox-control__label {
padding-left: $grid-unit-20;
Expand Down

0 comments on commit 46f638e

Please sign in to comment.