11'use client'
22
3- import styled from '@emotion/styled'
43import { ArrowLeftIcon , ArrowRightIcon } from '@ultraviolet/icons'
54import { useCallback , useMemo } from 'react'
65import { Button } from '../Button'
76import { Stack } from '../Stack'
87import { Text } from '../Text'
98import { getPageNumbers } from './getPageNumbers'
10-
11- const PageNumbersContainer = styled ( Stack ) `
12- margin: 0 ${ ( { theme } ) => theme . space [ '1' ] } ;
13- `
14-
15- const PageButton = styled ( Button , {
16- shouldForwardProp : prop => ! [ 'width' ] . includes ( prop ) ,
17- } ) < { width : string } > `
18- width: ${ ( { theme, width } ) => ( width === 'small' ? theme . sizing [ 400 ] : theme . sizing [ 500 ] ) } ;
19- `
20-
21- const Ellipsis = styled ( Text , {
22- shouldForwardProp : prop => ! [ 'width' ] . includes ( prop ) ,
23- } ) < { size : string } > `
24- align-content: center;
25- padding: ${ ( { theme } ) => theme . space [ 1 ] } ;
26- height: ${ ( { theme, size } ) => ( size === 'small' ? theme . sizing [ 400 ] : theme . sizing [ 500 ] ) } ;
27- width: ${ ( { theme, size } ) => ( size === 'small' ? theme . sizing [ 400 ] : theme . sizing [ 500 ] ) } ;
28- `
9+ import { ellipsisClass , pageButton , pageNumbersContainer } from './styles.css'
2910
3011type PaginationButtonsProps = {
3112 page : number
@@ -56,31 +37,31 @@ const MakeButton = ({
5637} : MakeButtonProps ) => (
5738 < >
5839 { hasEllipsisBefore ? (
59- < Ellipsis
40+ < Text
6041 aria-label = "ellipsis"
6142 as = "span"
43+ className = { ellipsisClass [ perPage ? 'small' : 'medium' ] }
6244 disabled = { disabled }
6345 placement = "center"
6446 prominence = "default"
6547 sentiment = "neutral"
66- size = { perPage ? 'small' : 'medium' }
6748 variant = "body"
6849 >
6950 ...
70- </ Ellipsis >
51+ </ Text >
7152 ) : null }
72- < PageButton
53+ < Button
7354 aria-current = { pageNumber === page }
55+ className = { pageButton [ perPage ? 'small' : 'medium' ] }
7456 disabled = { disabled }
7557 onClick = { handlePageClick ( pageNumber ) }
7658 sentiment = { pageNumber === page ? 'primary' : 'neutral' }
7759 size = { perPage ? 'small' : 'medium' }
7860 type = "button"
7961 variant = { pageNumber === page ? 'filled' : 'outlined' }
80- width = { perPage ? 'small' : 'medium' }
8162 >
8263 { pageNumber }
83- </ PageButton >
64+ </ Button >
8465 </ >
8566)
8667
@@ -128,7 +109,7 @@ export const PaginationButtons = ({
128109 < ArrowLeftIcon />
129110 </ Button >
130111 </ Stack >
131- < PageNumbersContainer direction = "row" gap = { 1 } >
112+ < Stack className = { pageNumbersContainer } direction = "row" gap = { 1 } >
132113 { pageNumbersToDisplay . map ( ( pageNumber , index ) => (
133114 < MakeButton
134115 disabled = { disabled }
@@ -145,7 +126,7 @@ export const PaginationButtons = ({
145126 perPage = { perPage }
146127 />
147128 ) ) }
148- </ PageNumbersContainer >
129+ </ Stack >
149130 < Stack gap = { 1 } >
150131 < Button
151132 aria-label = "Next"
0 commit comments