import cx from "classnames"; import React from "react"; import { Icon } from "../Icon/index"; interface PaginationItemProps { /** aria-label of page item */ ariaLabel?: string; /** Text label inside page item */ label?: string; /** Show icon as label */ hasIcon?: boolean; /** Link href */ href?: string; /** Active state */ isActive?: boolean; /** Is first item */ isFirst?: boolean; /** Is last item */ isLast?: boolean; /** Additional CSS classes */ className?: string; } const ITEM_CLASS_ROOT = "pagination__item"; const ANCHOR_CLASS_ROOT = "pagination__link"; export const PaginationItem: React.FC = ({ ariaLabel, className, hasIcon, href, isActive, isFirst, isLast, label, ...other }) => { const itemClasses = cx(ITEM_CLASS_ROOT, className); const anchorClasses = cx(ANCHOR_CLASS_ROOT, "btn btn--square", { [`${ANCHOR_CLASS_ROOT}--active`]: isActive, }); return (
  • {hasIcon && isFirst && } {!hasIcon && label} {hasIcon && isLast && }
  • ); }; PaginationItem.displayName = "PaginationItem";