/** @jsx h */ import { h } from 'preact'; import { cx } from '@algolia/ui-components-shared'; import { isSpecialClick, capitalize } from '../../lib/utils'; import type { CurrentRefinementsConnectorParamsItem, CurrentRefinementsConnectorParamsRefinement, } from '../../connectors/current-refinements/connectCurrentRefinements'; import type { CurrentRefinementsCSSClasses } from '../../widgets/current-refinements/current-refinements'; import type { ComponentCSSClasses } from '../../types'; export type CurrentRefinementsComponentCSSClasses = ComponentCSSClasses; export type CurrentRefinementsProps = { items: CurrentRefinementsConnectorParamsItem[]; cssClasses: CurrentRefinementsComponentCSSClasses; canRefine: boolean; }; const createItemKey = ({ attribute, value, type, operator, }: CurrentRefinementsConnectorParamsRefinement): string => [attribute, type, value, operator] .map((key) => key) .filter(Boolean) .join(':'); const handleClick = (callback: () => void) => (event: any) => { if (isSpecialClick(event)) { return; } event.preventDefault(); callback(); }; const CurrentRefinements = ({ items, cssClasses, canRefine, }: CurrentRefinementsProps) => (
); export default CurrentRefinements;