-
-
+
+
© {copyrightDate} {copyrightName}
- {copyrightName.length && !copyrightName.endsWith('.') ? '.' : ''} All rights reserved.
-
-
-
- View the source
-
-
-
- Created by ▲ Vercel
-
-
+ {copyrightName.length && !copyrightName.endsWith(".")
+ ? "."
+ : ""}{" "}
+ All rights reserved.
+
diff --git a/components/layout/navbar/index.tsx b/components/layout/navbar/index.tsx
index 6c7f3dead..c31ee77ca 100644
--- a/components/layout/navbar/index.tsx
+++ b/components/layout/navbar/index.tsx
@@ -1,43 +1,32 @@
-import CartModal from 'components/cart/modal';
-import LogoSquare from 'components/logo-square';
-import { getMenu } from 'lib/shopify';
-import { Menu } from 'lib/shopify/types';
-import Link from 'next/link';
-import { Suspense } from 'react';
-import MobileMenu from './mobile-menu';
-import Search, { SearchSkeleton } from './search';
+import Link from "next/link";
-const { SITE_NAME } = process.env;
+import LogoSquare from "@/components/logo-square";
+import { getMenu } from "@/lib/store/menu";
+import MobileMenu from "./mobile-menu";
+import Search from "./search";
-export async function Navbar() {
- const menu = await getMenu('next-js-frontend-header-menu');
+export default async function Navbar() {
+ const menu = await getMenu("navbar");
return (
-
-
-
-
-
-
- {SITE_NAME}
-
+
+ Store
+
- {menu.length ? (
+ {menu?.items ? (
- {menu.map((item: Menu) => (
+ {menu.items.map((item) => (
{item.title}
@@ -48,14 +37,35 @@ export async function Navbar() {
) : null}
- }>
-
-
+
+
+
+
);
}
diff --git a/components/layout/navbar/mobile-menu.tsx b/components/layout/navbar/mobile-menu.tsx
index ea59f8da9..2568cdaf8 100644
--- a/components/layout/navbar/mobile-menu.tsx
+++ b/components/layout/navbar/mobile-menu.tsx
@@ -1,15 +1,18 @@
-'use client';
+"use client";
-import { Dialog, Transition } from '@headlessui/react';
-import Link from 'next/link';
-import { usePathname, useSearchParams } from 'next/navigation';
-import { Fragment, Suspense, useEffect, useState } from 'react';
+import { Dialog, Transition } from "@headlessui/react";
+import Link from "next/link";
+import { usePathname, useSearchParams } from "next/navigation";
+import { Fragment, useEffect, useState } from "react";
-import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/outline';
-import { Menu } from 'lib/shopify/types';
-import Search, { SearchSkeleton } from './search';
+import { Menu } from "@/lib/store/menu";
+import Search from "./search";
-export default function MobileMenu({ menu }: { menu: Menu[] }) {
+interface MobileMenuProps {
+ menu?: Menu;
+}
+
+export default function MobileMenu({ menu }: MobileMenuProps) {
const pathname = usePathname();
const searchParams = useSearchParams();
const [isOpen, setIsOpen] = useState(false);
@@ -22,9 +25,9 @@ export default function MobileMenu({ menu }: { menu: Menu[] }) {
setIsOpen(false);
}
};
- window.addEventListener('resize', handleResize);
- return () => window.removeEventListener('resize', handleResize);
- }, [isOpen]);
+ window.addEventListener("resize", handleResize);
+ return () => window.removeEventListener("resize", handleResize);
+ }, []);
useEffect(() => {
setIsOpen(false);
@@ -35,10 +38,24 @@ export default function MobileMenu({ menu }: { menu: Menu[] }) {
-
+
+
+
+
-
+
+
+
-
- }>
-
-
+
- {menu.length ? (
+ {menu?.items ? (
- {menu.map((item: Menu) => (
+ {menu.items.map((item) => (
-
+
{item.title}
diff --git a/components/layout/product-grid-items.tsx b/components/layout/product-grid-items.tsx
index 5dee98368..89b1a59b6 100644
--- a/components/layout/product-grid-items.tsx
+++ b/components/layout/product-grid-items.tsx
@@ -1,9 +1,14 @@
-import Grid from 'components/grid';
-import { GridTileImage } from 'components/grid/tile';
-import { Product } from 'lib/shopify/types';
-import Link from 'next/link';
+import Grid from "components/grid";
+import { GridTileImage } from "components/grid/tile";
+import { Product } from "lib/store/types";
+import { getImageUrl } from "lib/utils/image";
+import Link from "next/link";
-export default function ProductGridItems({ products }: { products: Product[] }) {
+export default function ProductGridItems({
+ products,
+}: {
+ products: Product[];
+}) {
return (
<>
{products.map((product) => (
@@ -18,9 +23,13 @@ export default function ProductGridItems({ products }: { products: Product[] })
label={{
title: product.title,
amount: product.priceRange.maxVariantPrice.amount,
- currencyCode: product.priceRange.maxVariantPrice.currencyCode
+ currencyCode: product.priceRange.maxVariantPrice.currencyCode,
}}
- src={product.featuredImage?.url}
+ src={
+ product.featuredImage
+ ? getImageUrl(product.featuredImage.source)
+ : ""
+ }
fill
sizes="(min-width: 768px) 33vw, (min-width: 640px) 50vw, 100vw"
/>
diff --git a/components/layout/search/collections.tsx b/components/layout/search/collections.tsx
index 4f42dd941..c784b0b83 100644
--- a/components/layout/search/collections.tsx
+++ b/components/layout/search/collections.tsx
@@ -1,37 +1,46 @@
-import clsx from 'clsx';
-import { Suspense } from 'react';
+import { getCollections } from "@/lib/store/products";
+import clsx from "clsx";
+import Link from "next/link";
+import { usePathname } from "next/navigation";
-import { getCollections } from 'lib/shopify';
-import FilterList from './filter';
-
-async function CollectionList() {
+export default async function Collections() {
const collections = await getCollections();
- return ;
-}
+ const pathname = usePathname();
-const skeleton = 'mb-3 h-4 w-5/6 animate-pulse rounded-sm';
-const activeAndTitles = 'bg-neutral-800 dark:bg-neutral-300';
-const items = 'bg-neutral-400 dark:bg-neutral-700';
-
-export default function Collections() {
return (
-
-
-
-
-
-
-
-
-
-
-
-
+ >
);
}
diff --git a/components/product/gallery.tsx b/components/product/gallery.tsx
index 885e50152..cf2a83ae8 100644
--- a/components/product/gallery.tsx
+++ b/components/product/gallery.tsx
@@ -1,31 +1,33 @@
-'use client';
+"use client";
-import { ArrowLeftIcon, ArrowRightIcon } from '@heroicons/react/24/outline';
-import { GridTileImage } from 'components/grid/tile';
-import { useProduct, useUpdateURL } from 'components/product/product-context';
-import Image from 'next/image';
+import { ArrowLeftIcon, ArrowRightIcon } from "@heroicons/react/24/outline";
+import { GridTileImage } from "components/grid/tile";
+import { useProduct } from "components/product/product-context";
+import { Image } from "lib/store/types";
+import { getImageUrl } from "lib/utils/image";
+import NextImage from "next/image";
-export function Gallery({ images }: { images: { src: string; altText: string }[] }) {
+export function Gallery({ images }: { images: Image[] }) {
const { state, updateImage } = useProduct();
- const updateURL = useUpdateURL();
const imageIndex = state.image ? parseInt(state.image) : 0;
const nextImageIndex = imageIndex + 1 < images.length ? imageIndex + 1 : 0;
- const previousImageIndex = imageIndex === 0 ? images.length - 1 : imageIndex - 1;
+ const previousImageIndex =
+ imageIndex === 0 ? images.length - 1 : imageIndex - 1;
const buttonClassName =
- 'h-full px-6 transition-all ease-in-out hover:scale-110 hover:text-black dark:hover:text-white flex items-center justify-center';
+ "h-full px-6 transition-all ease-in-out hover:scale-110 hover:text-black dark:hover:text-white flex items-center justify-center";
return (