diff --git a/packages/instantsearch.js/src/widgets/clear-refinements/__tests__/clear-refinements.test.tsx b/packages/instantsearch.js/src/widgets/clear-refinements/__tests__/clear-refinements.test.tsx index bfd10d671a..0effc7d975 100644 --- a/packages/instantsearch.js/src/widgets/clear-refinements/__tests__/clear-refinements.test.tsx +++ b/packages/instantsearch.js/src/widgets/clear-refinements/__tests__/clear-refinements.test.tsx @@ -158,11 +158,9 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/clear-refin clearRefinements({ container, templates: { - resetLabel({ hasRefinements }, { html }) { + resetLabel({ canRefine }, { html }) { return html`${hasRefinements - ? 'Clear refinements' - : 'No refinements'}${canRefine ? 'Clear refinements' : 'No refinements'}`; }, }, @@ -235,10 +233,10 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/clear-refin clearRefinements({ container, templates: { - resetLabel({ hasRefinements }) { + resetLabel({ canRefine }) { return ( - {hasRefinements ? 'Clear refinements' : 'No refinements'} + {canRefine ? 'Clear refinements' : 'No refinements'} ); }, diff --git a/packages/instantsearch.js/src/widgets/clear-refinements/clear-refinements.tsx b/packages/instantsearch.js/src/widgets/clear-refinements/clear-refinements.tsx index 234cdc6d4a..f4033ac7cf 100644 --- a/packages/instantsearch.js/src/widgets/clear-refinements/clear-refinements.tsx +++ b/packages/instantsearch.js/src/widgets/clear-refinements/clear-refinements.tsx @@ -89,7 +89,7 @@ export type ClearRefinementsTemplates = Partial<{ /** * Template for the content of the button */ - resetLabel: Template<{ hasRefinements: boolean }>; + resetLabel: Template<{ canRefine: boolean }>; }>; export type ClearRefinementsWidgetParams = { diff --git a/packages/react-instantsearch/src/ui/CurrentRefinements.tsx b/packages/react-instantsearch/src/ui/CurrentRefinements.tsx index 8aa49e1613..f5fab56257 100644 --- a/packages/react-instantsearch/src/ui/CurrentRefinements.tsx +++ b/packages/react-instantsearch/src/ui/CurrentRefinements.tsx @@ -14,7 +14,7 @@ export type CurrentRefinementsProps = React.ComponentProps<'div'> & { > & Record >; - hasRefinements?: boolean; + canRefine?: boolean; }; export type CurrentRefinementsClassNames = { @@ -59,7 +59,7 @@ export type CurrentRefinementsClassNames = { export function CurrentRefinements({ classNames = {}, items = [], - hasRefinements = false, + canRefine = false, ...props }: CurrentRefinementsProps) { return ( @@ -68,7 +68,7 @@ export function CurrentRefinements({ className={cx( 'ais-CurrentRefinements', classNames.root, - !hasRefinements && + !canRefine && cx( 'ais-CurrentRefinements--noRefinement', classNames.noRefinementRoot @@ -81,7 +81,7 @@ export function CurrentRefinements({ 'ais-CurrentRefinements-list', classNames.list, /* @MAJOR remove to ensure conformity with InstantSearch.css specs */ - !hasRefinements && + !canRefine && cx( 'ais-CurrentRefinements-list--noRefinement', classNames.noRefinementList diff --git a/packages/react-instantsearch/src/ui/__tests__/CurrentRefinements.test.tsx b/packages/react-instantsearch/src/ui/__tests__/CurrentRefinements.test.tsx index 1629522420..a3457b5765 100644 --- a/packages/react-instantsearch/src/ui/__tests__/CurrentRefinements.test.tsx +++ b/packages/react-instantsearch/src/ui/__tests__/CurrentRefinements.test.tsx @@ -52,7 +52,7 @@ describe('CurrentRefinements', () => { ], }, ]} - hasRefinements={true} + canRefine={true} /> ); @@ -72,7 +72,7 @@ describe('CurrentRefinements', () => { > Brand : - + { > Brand : - + ; +type UiProps = Pick; export type CurrentRefinementsProps = Omit< CurrentRefinementsUiComponentProps, @@ -36,7 +33,7 @@ export function CurrentRefinements({ const uiProps: UiProps = { items, - hasRefinements: canRefine, + canRefine, }; return ;