import { ChevronLeftIcon, ChevronRightIcon } from "@chakra-ui/icons"; import { Stack } from "@chakra-ui/react"; import type { FunctionComponent } from "react"; import { ArrowButton } from "./ArrowButton"; import { SEARCH_ANALYTICS } from "./constants"; import { GoToPage } from "./GoToPage"; import testIds from "./testIds"; import { useUpdateSearchParam } from "./useUpdateSearchParam"; import { eventName } from "../../contexts/Analytics"; export interface PageControlsProps { offset: number; pageLimit: number; } export const PageControls: FunctionComponent = ({ offset, pageLimit, }) => { const updateSearch = useUpdateSearchParam(); const goForward = offset < pageLimit ? () => updateSearch({ offset: offset + 1 }) : undefined; const goBack = offset > 0 ? () => updateSearch({ offset: offset - 1 }) : undefined; return ( ); };