diff --git a/app/globals.css b/app/globals.css
index 0a6d36768..21bbc4a01 100644
--- a/app/globals.css
+++ b/app/globals.css
@@ -2,12 +2,6 @@
@tailwind components;
@tailwind utilities;
-@media (prefers-color-scheme: dark) {
- html {
- color-scheme: dark;
- }
-}
-
@supports (font: -apple-system-body) and (-webkit-appearance: none) {
img[loading='lazy'] {
clip-path: inset(0.6px);
diff --git a/app/search/[collection]/page.tsx b/app/search/[collection]/page.tsx
index 25416d544..181186fe4 100644
--- a/app/search/[collection]/page.tsx
+++ b/app/search/[collection]/page.tsx
@@ -2,9 +2,14 @@ import { getCollection, getCollectionProducts } from 'lib/shopify';
import { Metadata } from 'next';
import { notFound } from 'next/navigation';
+import Breadcrumb from 'components/breadcrumb';
+import BreadcrumbHome from 'components/breadcrumb/breadcrumb-home';
import Grid from 'components/grid';
import ProductGridItems from 'components/layout/product-grid-items';
+import Filters from 'components/layout/search/filters';
+import SortingMenu from 'components/layout/search/sorting-menu';
import { defaultSort, sorting } from 'lib/constants';
+import { Suspense } from 'react';
export const runtime = 'edge';
@@ -33,17 +38,43 @@ export default async function CategoryPage({
}) {
const { sort } = searchParams as { [key: string]: string };
const { sortKey, reverse } = sorting.find((item) => item.slug === sort) || defaultSort;
- const products = await getCollectionProducts({ collection: params.collection, sortKey, reverse });
+ const productsData = getCollectionProducts({ collection: params.collection, sortKey, reverse });
+ const collectionData = getCollection(params.collection);
+
+ const [products, collection] = await Promise.all([productsData, collectionData]);
return (
-
- {products.length === 0 ? (
- {`No products found in this collection`}
- ) : (
-
-
-
- )}
-
+ <>
+
+ }>
+
+
+
+ {collection ? (
+
+
{collection.title}
+
{collection.description}
+
+ ) : null}
+
+
+
+
+ {products.length === 0 ? (
+ {`No products found in this collection`}
+ ) : (
+
+
+
+
+ )}
+
+ >
);
}
diff --git a/app/search/layout.tsx b/app/search/layout.tsx
index 011d41e8b..7bdb8cf47 100644
--- a/app/search/layout.tsx
+++ b/app/search/layout.tsx
@@ -1,21 +1,10 @@
import Footer from 'components/layout/footer';
-import Collections from 'components/layout/search/collections';
-import FilterList from 'components/layout/search/filter';
-import { sorting } from 'lib/constants';
import { Suspense } from 'react';
export default function SearchLayout({ children }: { children: React.ReactNode }) {
return (
-
-
-
-
-
{children}
-
-
-
-
+ {children}
);
diff --git a/components/breadcrumb/breadcrumb-home.tsx b/components/breadcrumb/breadcrumb-home.tsx
new file mode 100644
index 000000000..62a0714ec
--- /dev/null
+++ b/components/breadcrumb/breadcrumb-home.tsx
@@ -0,0 +1,15 @@
+import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList } from './breadcrumb-list';
+
+const BreadcrumbHome = () => {
+ return (
+
+
+
+ Home
+
+
+
+ );
+};
+
+export default BreadcrumbHome;
diff --git a/components/breadcrumb/index.tsx b/components/breadcrumb/index.tsx
index a5d532efd..08f0c90e5 100644
--- a/components/breadcrumb/index.tsx
+++ b/components/breadcrumb/index.tsx
@@ -1,4 +1,5 @@
-import { getProduct } from 'lib/shopify';
+import { getCollection, getMenu, getProduct } from 'lib/shopify';
+import { Menu } from 'lib/shopify/types';
import { Fragment } from 'react';
import {
Breadcrumb,
@@ -14,6 +15,23 @@ type BreadcrumbProps = {
handle: string;
};
+const findParentCollection = (menu: Menu[], collection: string): Menu | null => {
+ let parentCollection: Menu | null = null;
+
+ for (const item of menu) {
+ if (item.items.length) {
+ console.log({ collection, item });
+ const hasParent = item.items.some((subItem) => subItem.path.includes(collection));
+ if (hasParent) {
+ parentCollection = item;
+ } else {
+ parentCollection = findParentCollection(item.items, collection);
+ }
+ }
+ }
+ return parentCollection;
+};
+
const BreadcrumbComponent = async ({ type, handle }: BreadcrumbProps) => {
const items: Array<{ href: string; title: string }> = [{ href: '/', title: 'Home' }];
@@ -35,6 +53,25 @@ const BreadcrumbComponent = async ({ type, handle }: BreadcrumbProps) => {
});
}
+ if (type === 'collection') {
+ const collectionData = getCollection(handle);
+ const menuData = getMenu('main-menu');
+ const [collection, menu] = await Promise.all([collectionData, menuData]);
+ if (!collection) return null;
+ const parentCollection = findParentCollection(menu, handle);
+ if (parentCollection && parentCollection.path !== `/search/${handle}`) {
+ items.push({
+ href: `${parentCollection.path}`,
+ title: parentCollection.title
+ });
+ }
+
+ items.push({
+ title: collection.title,
+ href: `/search/${collection.handle}`
+ });
+ }
+
return (
diff --git a/components/layout/navbar/index.tsx b/components/layout/navbar/index.tsx
index 841322718..bea24306b 100644
--- a/components/layout/navbar/index.tsx
+++ b/components/layout/navbar/index.tsx
@@ -4,9 +4,9 @@ import LogoSquare from 'components/logo-square';
import Profile from 'components/profile';
import OpenProfile from 'components/profile/open-profile';
import { getMenu } from 'lib/shopify';
-import { Menu } from 'lib/shopify/types';
import Link from 'next/link';
import { Suspense } from 'react';
+import MainMenu from './main-menu';
import MobileMenu from './mobile-menu';
import Search, { SearchSkeleton } from './search';
const { SITE_NAME } = process.env;
@@ -15,7 +15,7 @@ export default async function Navbar() {
const menu = await getMenu('main-menu');
return (
-