Skip to content

Commit

Permalink
Add attribute to appear in mobile web search
Browse files Browse the repository at this point in the history
  • Loading branch information
julixC committed Feb 26, 2025
1 parent d45db10 commit 99fa558
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
18 changes: 18 additions & 0 deletions react/components/FacetCheckboxListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { applyModifiers } from 'vtex.css-handles'
import { Checkbox } from 'vtex.styleguide'
import { usePixel } from 'vtex.pixel-manager'
import { useIntl } from 'react-intl'
import { useRuntime } from 'vtex.render-runtime'

import styles from '../searchResult.css'
import { pushFilterManipulationPixelEvent } from '../utils/filterManipulationPixelEvents'
Expand Down Expand Up @@ -60,6 +61,17 @@ const FacetCheckboxListItem = ({
intl,
])

const runtimeQuery = useRuntime()?.query

let initialmap
let initialquery

if (searchQuery?.variables?.fullText === undefined) {
initialquery = runtimeQuery?.initialQuery ?? searchQuery?.facets?.queryArgs.query

initialmap = runtimeQuery?.initialMap ?? searchQuery?.facets?.queryArgs?.map
}

return (
<div
className={classNames(
Expand All @@ -86,6 +98,12 @@ const FacetCheckboxListItem = ({
onFilterCheck({ ...facet, title: facetTitle })
}}
value={name}
isClicked={facet.selected.toString()}
facetKey={facet.key}
facetValue={facet.value}
fullText={searchQuery?.variables?.fullText}
initialMap={initialmap}
initialQuery={initialquery}
/>
</div>
)
Expand Down
3 changes: 2 additions & 1 deletion react/components/FacetItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ const FacetItem = ({
navigateToFacet({ ...facet, title: facetTitle }, preventRouteChange)
}}
disabled={shouldDisable}
value={facet.value}
value={facet.name}
facetKey={facet.key}
facetValue={facet.value}
isClicked={selected.toString()}
fullText={searchQuery?.variables?.fullText}
initialMap={initialmap}
Expand Down

0 comments on commit 99fa558

Please sign in to comment.