-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathindex.tsx
More file actions
39 lines (34 loc) · 847 Bytes
/
index.tsx
File metadata and controls
39 lines (34 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import type { FC } from 'react';
import type { LinkLike } from '#ui/types';
import styles from './index.module.css';
export type PaginationListItemProps = {
url: string;
pageNumber: number;
// One-based number of the current page
currentPage: number;
totalPages: number;
as?: LinkLike;
label: string;
};
const PaginationListItem: FC<PaginationListItemProps> = ({
url,
pageNumber,
currentPage,
totalPages,
as: Component = 'a',
label,
}) => {
return (
<li key={pageNumber} aria-setsize={totalPages} aria-posinset={pageNumber}>
<Component
href={url}
aria-label={label}
className={styles.listItem}
{...(pageNumber === currentPage && { 'aria-current': 'page' })}
>
<span>{pageNumber}</span>
</Component>
</li>
);
};
export default PaginationListItem;