diff --git a/src/lib/components/Flowbite/FlowbiteTheme.ts b/src/lib/components/Flowbite/FlowbiteTheme.ts index fd8f1c37a..6b45caa05 100644 --- a/src/lib/components/Flowbite/FlowbiteTheme.ts +++ b/src/lib/components/Flowbite/FlowbiteTheme.ts @@ -159,6 +159,31 @@ export interface FlowbiteTheme { }; }; }; + pagination: { + base: string; + layout: { + table: { + base: string; + span: string; + }; + }; + pages: { + base: string; + showIcon: string; + previous: { + base: string; + icon: string; + }; + next: { + base: string; + icon: string; + }; + selector: { + base: string; + active: string; + }; + }; + }; spinner: { base: string; color: SpinnerColors; diff --git a/src/lib/components/Pagination/index.tsx b/src/lib/components/Pagination/index.tsx index 74cebaf48..1f65928f0 100644 --- a/src/lib/components/Pagination/index.tsx +++ b/src/lib/components/Pagination/index.tsx @@ -1,10 +1,12 @@ import classNames from 'classnames'; import type { ComponentProps, FC, PropsWithChildren } from 'react'; import { HiChevronLeft, HiChevronRight } from 'react-icons/hi'; +import { excludeClassName } from '../../helpers/exclude'; import range from '../../helpers/range'; +import { useTheme } from '../Flowbite/ThemeContext'; export type PaginationProps = PropsWithChildren; -interface Pagination extends ComponentProps<'nav'> { +interface Pagination extends Omit, 'className'> { currentPage: number; layout?: 'navigation' | 'pagination' | 'table'; onPageChange: (page: number) => void; @@ -18,11 +20,14 @@ export const Pagination: FC = ({ onPageChange, showIcons: showIcon = false, totalPages, - ...rest + ...props }): JSX.Element => { const firstPage = Math.max(1, currentPage - 3); const lastPage = Math.min(currentPage + 3, totalPages); + const theme = useTheme().theme.pagination; + const theirProps = excludeClassName(props); + const goToNextPage = (): void => { onPageChange(Math.min(currentPage + 1, totalPages)); }; @@ -32,24 +37,21 @@ export const Pagination: FC = ({ }; return ( -