import { getStrWithZeroFromNum } from "@web3r/flowerkit/str"; import type { FC, ReactElement } from "react"; import { useContext } from "react"; import type { IComponentBaseProps } from "../../../types/components"; import { Input } from "../../input"; import type { IPaginationItem } from "../config/types"; import { PaginationContext } from "../context"; /** * Компонент элемента пагинации. * @returns {ReactElement} */ export const PaginationItem: FC = (props = {}): ReactElement => { const { getCN, form, separator, name, handleClick, handleChange, } = useContext(PaginationContext); const { children, onClick = handleClick, onChange = handleChange, isActive = false, isSeparator = false, page = 0, href = "", label = "", extraClasses = {}, extraAttrs = {}, title, } = props; let content = label; if (!content) { if (isSeparator) { content = separator ?? ""; } else { content = getStrWithZeroFromNum(page); } } return (
  • {children || ( name ? : onClick({ event, data: props })} href={href} className={getCN("link")} > {content} )}
  • ); };