Skip to content

Commit

Permalink
replace useWindow hook usage with responsive object
Browse files Browse the repository at this point in the history
  • Loading branch information
joshfarrant committed Feb 19, 2025
1 parent 1130807 commit c48885b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/react/src/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {memo, PropsWithChildren, useCallback} from 'react'
import {Link, Text, useWindowSize} from '..'
import {Link, Text} from '..'

import {default as clsx} from 'clsx'

Expand Down Expand Up @@ -56,14 +56,12 @@ export const Pagination = memo(
hrefBuilder = defaultHrefBuilder,
pageAttributesBuilder,
marginPageCount = 1,
showPages,
showPages = {narrow: false, regular: true, wide: true},
surroundingPageCount = 2,
'aria-label': ariaLabel,
'data-testid': testId,
...rest
}: PaginationProps) => {
const {isMedium} = useWindowSize()

const navRef = React.useRef<HTMLElement>(null)
const pageElements = usePaginationPages({
pageCount,
Expand All @@ -72,7 +70,7 @@ export const Pagination = memo(
hrefBuilder,
pageAttributesBuilder,
marginPageCount,
showPages: showPages !== undefined ? showPages : isMedium ? true : false,
showPages,
surroundingPageCount,
})

Expand Down Expand Up @@ -118,7 +116,7 @@ type UsePaginationPagesParameters = {
hrefBuilder: (n: number) => string
pageAttributesBuilder?: (n: number) => {[key: string]: string}
marginPageCount: number
showPages?: PaginationProps['showPages']
showPages: PaginationProps['showPages']
surroundingPageCount: number
}

Expand Down

0 comments on commit c48885b

Please sign in to comment.