♻️(frontend) decouple PaginationControl from usePagination hook

Replace ReturnType<typeof usePagination> prop type with explicit Props
interface defining only required fields (currentPage, totalPages,
onPageChange) to decouple component from internal hook implementation.

Eliminates unnecessary runtime dependency and improves component API
clarity by explicitly declaring required props instead of coupling to
hook internals, making the component more maintainable and reusable.
This commit is contained in:
lebaudantoine
2025-09-05 12:15:54 +02:00
committed by aleb_the_flash
parent 47cc88c820
commit 67d61b8cf7

View File

@@ -1,19 +1,16 @@
import * as React from 'react' import * as React from 'react'
import { createInteractingObservable } from '@livekit/components-core' import { createInteractingObservable } from '@livekit/components-core'
import { usePagination } from '@livekit/components-react'
import { RiArrowLeftSLine, RiArrowRightSLine } from '@remixicon/react' import { RiArrowLeftSLine, RiArrowRightSLine } from '@remixicon/react'
import { Button } from '@/primitives' import { Button } from '@/primitives'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { css } from '@/styled-system/css' import { css } from '@/styled-system/css'
export interface PaginationControlProps export interface PaginationControlProps {
extends Pick< totalPageCount: number
ReturnType<typeof usePagination>, nextPage: () => void
'totalPageCount' | 'nextPage' | 'prevPage' | 'currentPage' prevPage: () => void
> { currentPage: number
/** Reference to an HTML element that holds the pages, while interacting (`mouseover`)
* with it, the pagination controls will appear for a while. */
pagesContainer?: React.RefObject<HTMLElement> pagesContainer?: React.RefObject<HTMLElement>
} }