Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/site/components/Common/CrossLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const CrossLink: FC<Omit<CrossLinkProps, 'as' | 'label'>> = props => {
const t = useTranslations();
return (
<BaseCrossLink
label={t(`components.common.crossLink.${props.type}`)}
label={t(`components.common.pagination.${props.type}`)}
as={Link}
{...props}
/>
Expand Down
8 changes: 4 additions & 4 deletions apps/site/components/Common/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ const Pagination: FC<
as={Link}
labels={{
aria: t('components.common.pagination.defaultLabel'),
prevAria: t('components.common.pagination.prevAriaLabel'),
prev: t('components.pagination.previous'),
nextAria: t('components.common.pagination.nextAriaLabel'),
next: t('components.pagination.next'),
previousAriaLabel: t('components.common.pagination.previousAriaLabel'),
previous: t('components.common.pagination.previous'),
nextAriaLabel: t('components.common.pagination.nextAriaLabel'),
next: t('components.common.pagination.next'),
}}
getPageLabel={pageNumber =>
t('components.common.pagination.pageLabel', { pageNumber })
Expand Down
12 changes: 2 additions & 10 deletions packages/i18n/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,6 @@
"npmVersion": "npm version",
"v8Version": "V8 version"
},
"pagination": {
"next": "Next",
"previous": "Previous"
},
"common": {
"alertBox": {
"info": "Info",
Expand All @@ -250,17 +246,13 @@
"breadcrumbs": {
"navigateToHome": "Navigate to Home"
},
"crossLink": {
"previous": "Prev",
"next": "Next"
},
"codebox": {
"copy": "Copy to clipboard",
"copied": "Copied to clipboard!"
},
"pagination": {
"prev": "Previous",
"prevAriaLabel": "Previous page",
"previous": "Previous",
"previousAriaLabel": "Previous page",
"next": "Next",
"nextAriaLabel": "Next page",
"defaultLabel": "Pagination",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import BasePagination from '#ui/Common/BasePagination';
const getPageLabel = number => number.toString();
const labels = {
aria: 'Aria',
prevAria: 'Previous Aria',
prev: 'Previous',
nextAria: 'Next Aria',
previousAriaLabel: 'Previous Aria',
previous: 'Previous',
nextAriaLabel: 'Next Aria',
next: 'Next',
};

Expand Down Expand Up @@ -51,14 +51,14 @@ describe('Pagination', () => {
assert.ok(
isVisible(
screen.getByRole('button', {
name: labels.prevAria,
name: labels.previousAriaLabel,
})
)
);
assert.ok(
isVisible(
screen.getByRole('button', {
name: labels.nextAria,
name: labels.nextAriaLabel,
})
)
);
Expand Down Expand Up @@ -157,7 +157,7 @@ describe('Pagination', () => {
assert.ok(
screen
.getByRole('button', {
name: labels.prevAria,
name: labels.previousAriaLabel,
})
.getAttribute('aria-disabled')
);
Expand All @@ -172,7 +172,7 @@ describe('Pagination', () => {
assert.ok(
screen
.getByRole('button', {
name: labels.nextAria,
name: labels.nextAriaLabel,
})
.getAttribute('aria-disabled')
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export const Default: Story = {
getPageLabel: value => `Page: ${value}`,
labels: {
aria: 'Aria',
prevAria: 'Previous Aria',
prev: 'Previous',
nextAria: 'Next Aria',
previousAriaLabel: 'Previous Aria',
previous: 'Previous',
nextAriaLabel: 'Next Aria',
next: 'Next',
},
},
Expand Down
12 changes: 6 additions & 6 deletions packages/ui-components/src/Common/BasePagination/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export type PaginationProps = {
getPageLabel: (pageNumber: number) => string;
labels: {
aria: string;
prevAria: string;
prev: string;
nextAria: string;
previousAriaLabel: string;
previous: string;
nextAriaLabel: string;
next: string;
};
};
Expand All @@ -48,21 +48,21 @@ const BasePagination: FC<PaginationProps> = ({
<nav aria-label={labels.aria} className={styles.pagination}>
<Button
as={as}
aria-label={labels.prevAria}
aria-label={labels.previousAriaLabel}
disabled={currentPage === 1}
kind="secondary"
className={styles.previousButton}
href={pages[currentPage - 2]?.url}
>
<ArrowLeftIcon className={styles.arrowIcon} />
<span>{labels.prev}</span>
<span>{labels.previous}</span>
</Button>

<ol className={styles.list}>{parsedPages}</ol>

<Button
as={as}
aria-label={labels.nextAria}
aria-label={labels.nextAriaLabel}
disabled={currentPage === pages.length}
kind="secondary"
className={styles.nextButton}
Expand Down
Loading