Skip to content

Commit

Permalink
feat: control visibility of search box via flag prop (#394)
Browse files Browse the repository at this point in the history
Co-authored-by: Maham Akif <[email protected]>
  • Loading branch information
mahamakifdar19 and Maham Akif authored May 15, 2024
1 parent 69b7864 commit 30d8f49
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions packages/catalog-search/src/SearchHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const SearchHeader = ({
disableSuggestionRedirect,
optimizelySuggestionClickHandler,
isPreQueryEnabled,
hideSearchBox,
}) => {
const { refinements } = useContext(SearchContext);
let searchQueryFromRefinements;
Expand All @@ -48,20 +49,22 @@ const SearchHeader = ({
xs={12}
md={8}
>
<SearchBox
className="mb-4"
defaultRefinement={searchQueryFromRefinements}
variant={variant}
headerTitle={headerTitle}
hideTitle={hideTitle}
index={index}
filters={filters}
enterpriseSlug={slug}
suggestionSubmitOverride={suggestionSubmitOverride}
disableSuggestionRedirect={disableSuggestionRedirect}
isPreQueryEnabled={isPreQueryEnabled}
optimizelySuggestionClickHandler={optimizelySuggestionClickHandler}
/>
{!hideSearchBox && (
<SearchBox
className="mb-4"
defaultRefinement={searchQueryFromRefinements}
variant={variant}
headerTitle={headerTitle}
hideTitle={hideTitle}
index={index}
filters={filters}
enterpriseSlug={slug}
suggestionSubmitOverride={suggestionSubmitOverride}
disableSuggestionRedirect={disableSuggestionRedirect}
isPreQueryEnabled={isPreQueryEnabled}
optimizelySuggestionClickHandler={optimizelySuggestionClickHandler}
/>
)}
</Col>
<Col
data-testid={filtersColTestId}
Expand All @@ -88,6 +91,7 @@ SearchHeader.defaultProps = {
index: undefined,
optimizelySuggestionClickHandler: undefined,
isPreQueryEnabled: false,
hideSearchBox: false,
};

SearchHeader.propTypes = {
Expand All @@ -110,6 +114,7 @@ SearchHeader.propTypes = {
disableSuggestionRedirect: PropTypes.bool,
optimizelySuggestionClickHandler: PropTypes.func,
isPreQueryEnabled: PropTypes.bool,
hideSearchBox: PropTypes.bool,
};

export default SearchHeader;

0 comments on commit 30d8f49

Please sign in to comment.