From 0115587e0056fb7b3cce3d4c41739a261ee7035b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=92scar=20Casajuana?= Date: Mon, 9 Sep 2024 10:20:49 +0200 Subject: [PATCH] Minor rename changes --- .../src/components/Pagination/EllipsisButton.tsx | 4 ++-- .../src/components/Pagination/Pagination.tsx | 15 +++++++-------- .../src/components/Pagination/PaginatorButton.tsx | 4 ++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/chakra-components/src/components/Pagination/EllipsisButton.tsx b/packages/chakra-components/src/components/Pagination/EllipsisButton.tsx index 56aa891..f8b1179 100644 --- a/packages/chakra-components/src/components/Pagination/EllipsisButton.tsx +++ b/packages/chakra-components/src/components/Pagination/EllipsisButton.tsx @@ -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 diff --git a/packages/chakra-components/src/components/Pagination/Pagination.tsx b/packages/chakra-components/src/components/Pagination/Pagination.tsx index 6318f56..39e270e 100644 --- a/packages/chakra-components/src/components/Pagination/Pagination.tsx +++ b/packages/chakra-components/src/components/Pagination/Pagination.tsx @@ -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 @@ -41,8 +41,8 @@ const usePaginationPages = ( createPageButton: CreatePageButtonType, inputProps?: InputProps, buttonProps?: ButtonProps -) => { - return useMemo(() => { +) => + useMemo(() => { if (totalPages === undefined) return [] let pages: ReactElement[] = [] @@ -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, diff --git a/packages/chakra-components/src/components/Pagination/PaginatorButton.tsx b/packages/chakra-components/src/components/Pagination/PaginatorButton.tsx index 17412fc..043707c 100644 --- a/packages/chakra-components/src/components/Pagination/PaginatorButton.tsx +++ b/packages/chakra-components/src/components/Pagination/PaginatorButton.tsx @@ -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((props, ref) => { +export const PageButton = forwardRef((props, ref) => { const styles = useStyleConfig('PageButton', props) return