import { getCollectionViewAttributes, type CollectionViewOptions } from "@shopify/hydrogen"; import type { JSX } from "solid-js"; /** * Renders Hydrogen's view event element, which sends `shopify:collection:view`. * The element sends the event once each time it connects. Key it on the collection handle, such * as with ``, where one component shows different collections. */ export function CollectionView( props: CollectionViewOptions & { class?: string; children: JSX.Element }, ) { const attributes = () => getCollectionViewAttributes({ collection: props.collection, productsCount: props.productsCount, }); // `attr:` sets HTML attributes. Without it, Solid sets properties on custom elements in the // browser, and the element only reads attributes. return ( {props.children} ); }