From cc901b9ce8c3360c1d5aee29f01cbcac5ea985ca Mon Sep 17 00:00:00 2001 From: Rami Bitar Date: Sat, 1 Aug 2026 12:15:49 -0400 Subject: [PATCH] Add product search with autocomplete, filters, and sort MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Header: search button opening a command-palette dialog with debounced product suggestions, a term chip, and View All - Command: shadcn-shaped primitives built on the project's own Dialog so no cmdk/radix dependency is introduced - /search: results grid with item count, sort (relevance, price asc/desc), and cursor-based load more - Filters: driven by the API's productFilters facets — colour swatches, labelled lists with counts, and a price range — round-tripped through each facet's raw input string so no filter shape is hardcoded Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_016jWbNNJLksC1QG8z8845FX --- app/search/page.tsx | 33 ++++ components/shopify/header.tsx | 2 + components/shopify/search-dialog.tsx | 175 +++++++++++++++++++ components/shopify/search-filters.tsx | 238 +++++++++++++++++++++++++ components/shopify/search-results.tsx | 241 ++++++++++++++++++++++++++ components/ui/command.tsx | 196 +++++++++++++++++++++ graphql/search.js | 79 +++++++++ hooks/use-shopify-search.ts | 120 +++++++++++++ 8 files changed, 1084 insertions(+) create mode 100644 app/search/page.tsx create mode 100644 components/shopify/search-dialog.tsx create mode 100644 components/shopify/search-filters.tsx create mode 100644 components/shopify/search-results.tsx create mode 100644 components/ui/command.tsx create mode 100644 graphql/search.js create mode 100644 hooks/use-shopify-search.ts diff --git a/app/search/page.tsx b/app/search/page.tsx new file mode 100644 index 0000000..e3498b9 --- /dev/null +++ b/app/search/page.tsx @@ -0,0 +1,33 @@ +import { Suspense } from 'react'; +import Header from '@/components/shopify/header'; +import Footer from '@/components/shopify/footer'; +import SearchResults from '@/components/shopify/search-results'; + +export const metadata = { + title: 'Search — Shop', +}; + +export default function Page() { + return ( + <> +
+ + {/* useSearchParams needs a Suspense boundary to prerender this route. */} + }> + + + +