Skip to content

Commit

Permalink
Minor rename changes
Browse files Browse the repository at this point in the history
  • Loading branch information
elboletaire committed Sep 9, 2024
1 parent a37bd91 commit 0115587
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState } from 'react'
import { useStyleConfig } from '@chakra-ui/system'
import { Button, ButtonProps, Input, InputProps } from '@chakra-ui/react'
import { useStyleConfig } from '@chakra-ui/system'
import { useState } from 'react'

type EllipsisButtonProps = ButtonProps & {
gotoPage: (page: number) => void
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ButtonGroup, ButtonGroupProps, ButtonProps, InputProps, Text } from '@chakra-ui/react'
import { ReactElement, useMemo } from 'react'
import { Link as RouterLink } from 'react-router-dom'
import { chakra, useMultiStyleConfig } from '@chakra-ui/system'
import { useLocalize, usePagination, useRoutedPagination } from '@vocdoni/react-providers'
import { PaginationResponse } from '@vocdoni/sdk'
import { useMultiStyleConfig, chakra } from '@chakra-ui/system'
import { ReactElement, useMemo } from 'react'
import { Link as RouterLink } from 'react-router-dom'
import { EllipsisButton } from './EllipsisButton'
import { PaginatorButton } from './PaginatorButton'
import { PageButton as PaginatorButton } from './PaginatorButton'

export type PaginationProps = ButtonGroupProps & {
maxButtons?: number | false
Expand Down Expand Up @@ -41,8 +41,8 @@ const usePaginationPages = (
createPageButton: CreatePageButtonType,
inputProps?: InputProps,
buttonProps?: ButtonProps
) => {
return useMemo(() => {
) =>
useMemo(() => {
if (totalPages === undefined) return []

let pages: ReactElement[] = []
Expand Down Expand Up @@ -79,8 +79,7 @@ const usePaginationPages = (
const endPage = currentPage + Math.floor(availableButtons / 2)
return [pages[0], startEllipsis, ...pages.slice(startPage, endPage - 1), endEllipsis, pages[totalPages - 1]]
}
}, [currentPage, totalPages, maxButtons, gotoPage])
}
}, [totalPages, maxButtons, gotoPage, inputProps, buttonProps, currentPage, createPageButton])

const PaginationButtons = ({
totalPages,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useStyleConfig } from '@chakra-ui/system'
import { Button, ButtonProps, forwardRef } from '@chakra-ui/react'
import { useStyleConfig } from '@chakra-ui/system'

export const PaginatorButton = forwardRef<ButtonProps, 'div'>((props, ref) => {
export const PageButton = forwardRef<ButtonProps, 'div'>((props, ref) => {
const styles = useStyleConfig('PageButton', props)
return <Button sx={styles} {...props} />
})

0 comments on commit 0115587

Please sign in to comment.