• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yext / search-ui-react / 16125506658

07 Jul 2025 06:59PM UTC coverage: 87.593% (-0.2%) from 87.811%
16125506658

Pull #544

github

web-flow
Merge 6993dcc32 into 058f5e91b
Pull Request #544: Merge main (v1.9.0) into develop

885 of 1127 branches covered (78.53%)

Branch coverage included in aggregate %.

96 of 100 new or added lines in 28 files covered. (96.0%)

1 existing line in 1 file now uncovered.

2066 of 2242 relevant lines covered (92.15%)

136.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

47.37
/src/components/ApplyFiltersButton.tsx
1
import { useTranslation } from 'react-i18next';
5✔
2
import { useSearchActions } from '@yext/search-headless-react';
5✔
3
import { useCallback } from 'react';
5✔
4
import { useComposedCssClasses } from '../hooks';
5✔
5
import { clearStaticRangeFilters, getSelectedNumericalFacetFields } from '../utils/filterutils';
5✔
6
import { executeSearch } from '../utils';
5✔
7
import React from 'react';
5✔
8

9
/**
10
 * Props for {@link ApplyFiltersButton}
11
 *
12
 * @public
13
 */
14
export interface ApplyFiltersButtonProps {
15
  /** The label for the button, defaults to 'Apply Filters' */
16
  label?: string,
17
  /** CSS classes for customizing the component styling. */
18
  customCssClasses?: ApplyFiltersButtonCssClasses
19
}
20

21
/**
22
 * The CSS class interface for {@link ApplyFiltersButtonProps}.
23
 *
24
 * @public
25
 */
26
export interface ApplyFiltersButtonCssClasses {
27
  button?: string
28
}
29

30
const builtInCssClasses: Readonly<ApplyFiltersButtonCssClasses> = {
5✔
31
  button: 'border border-gray-300 px-2.5 py-1 rounded-md text-primary bg-white shadow-md sticky bottom-3'
32
};
33

34
/**
35
 * Runs a vertical search.
36
 * By default has `position: sticky` styling that anchors it to the bottom of the page.
37
 *
38
 * @remarks
39
 * This is intended to be used when `searchOnChange` field is set to false on all
40
 * the Facets/StaticFilters components.
41
 *
42
 * @public
43
 */
44
export function ApplyFiltersButton({
5✔
45
  customCssClasses,
46
  label
47
}: ApplyFiltersButtonProps): JSX.Element {
NEW
48
  const { t } = useTranslation();
×
49
  const cssClasses = useComposedCssClasses(builtInCssClasses, customCssClasses);
×
50
  const searchActions = useSearchActions();
×
51
  const handleClick = useCallback(() => {
×
52
    searchActions.setOffset(0);
×
53
    clearStaticRangeFilters(searchActions, getSelectedNumericalFacetFields(searchActions));
×
54
    executeSearch(searchActions);
×
55
  }, [searchActions]);
56

57
  return (
×
58
    <button
59
      onClick={handleClick}
60
      className={cssClasses.button}
61
    >
62
      {label ?? t('applyFilters')}
×
63
    </button>
64
  );
65
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc