From 6a5aa06841550d7c99b77a2e1017673a26a0f7e8 Mon Sep 17 00:00:00 2001 From: Henrik Larsson Date: Fri, 11 Aug 2023 16:04:47 +0200 Subject: [PATCH] Fixed bugs --- app/[locale]/category/[slug]/page.tsx | 8 +++++++- app/[locale]/product/[slug]/page.tsx | 10 ---------- app/[locale]/search/page.tsx | 7 ++++++- components/cart/modal.tsx | 13 +++++-------- components/layout/header/search/modal.tsx | 1 + components/product/product-view.tsx | 2 +- components/search/search-result.tsx | 2 +- components/search/search.tsx | 13 +------------ components/ui/sheet.tsx | 2 +- 9 files changed, 23 insertions(+), 35 deletions(-) diff --git a/app/[locale]/category/[slug]/page.tsx b/app/[locale]/category/[slug]/page.tsx index cdd56ed03..e3be582ba 100644 --- a/app/[locale]/category/[slug]/page.tsx +++ b/app/[locale]/category/[slug]/page.tsx @@ -1,5 +1,6 @@ import Search from '@/components/search/search'; import SearchResult from '@/components/search/search-result'; +import Text from '@/components/ui/text/text'; import { categoryQuery } from '@/lib/sanity/queries'; import { clientFetch } from '@/lib/sanity/sanity.client'; import { Metadata } from 'next'; @@ -36,7 +37,12 @@ export default async function ProductPage({ params }: CategoryPageParams) { return (
- + {title && ( + + {title} + + )} +
diff --git a/app/[locale]/product/[slug]/page.tsx b/app/[locale]/product/[slug]/page.tsx index db6ebef81..042acecc9 100644 --- a/app/[locale]/product/[slug]/page.tsx +++ b/app/[locale]/product/[slug]/page.tsx @@ -62,17 +62,7 @@ export default async function ProductPage({ params }: ProductPageParams) { '@type': 'Product', name: product.name, description: product.description, - // @TODO UPDATE TO STORM URL??? image: product.images[0].asset.url - // offers: { - // '@type': 'AggregateOffer', - // availability: product.availableForSale - // ? 'https://schema.org/InStock' - // : 'https://schema.org/OutOfStock', - // priceCurrency: product.priceRange.minVariantPrice.currencyCode, - // highPrice: product.priceRange.maxVariantPrice.amount, - // lowPrice: product.priceRange.minVariantPrice.amount - // } }; return ( diff --git a/app/[locale]/search/page.tsx b/app/[locale]/search/page.tsx index 2b879737d..2e8e43f2c 100644 --- a/app/[locale]/search/page.tsx +++ b/app/[locale]/search/page.tsx @@ -2,6 +2,7 @@ import Search from '@/components/search/search'; import SearchResult from '@/components/search/search-result'; +import Text from '@/components/ui/text/text'; import { useTranslations } from 'next-intl'; export default function SearchPage() { @@ -9,7 +10,11 @@ export default function SearchPage() { return (
- + + {t('search')} + + +
diff --git a/components/cart/modal.tsx b/components/cart/modal.tsx index 8abeaebef..957796002 100644 --- a/components/cart/modal.tsx +++ b/components/cart/modal.tsx @@ -70,10 +70,7 @@ export default function CartModal({ cart }: { cart: Cart | undefined }) { ); return ( -
  • +
  • @@ -83,7 +80,7 @@ export default function CartModal({ cart }: { cart: Cart | undefined }) { onClick={() => setIsOpen(false)} className="z-30 flex flex-row space-x-4" > -
    +
    -
    +

    {item.quantity} @@ -165,7 +162,7 @@ export default function CartModal({ cart }: { cart: Cart | undefined }) { onClick={() => setIsOpen(false)} className="z-30 flex flex-row space-x-4" > -

    +
    Product title @@ -188,7 +185,7 @@ export default function CartModal({ cart }: { cart: Cart | undefined }) { onClick={() => setIsOpen(false)} className="z-30 flex flex-row space-x-4" > -
    +
    Product title diff --git a/components/layout/header/search/modal.tsx b/components/layout/header/search/modal.tsx index 5123f00d7..5b907109b 100644 --- a/components/layout/header/search/modal.tsx +++ b/components/layout/header/search/modal.tsx @@ -55,6 +55,7 @@ export default function SearchModal() { diff --git a/components/product/product-view.tsx b/components/product/product-view.tsx index 48db7ee62..5336bd646 100644 --- a/components/product/product-view.tsx +++ b/components/product/product-view.tsx @@ -26,7 +26,7 @@ export default function ProductView({ product, relatedProducts }: ProductViewPro const { name, description, price, images } = product; return ( -
    +
    diff --git a/components/search/search-result.tsx b/components/search/search-result.tsx index 54d037d73..e009946be 100644 --- a/components/search/search-result.tsx +++ b/components/search/search-result.tsx @@ -40,7 +40,7 @@ export default function SearchResult() { classNames={{ root: cn('flex flex-col flex-1'), list: cn( - 'grid grid-cols-2 mt-4 gap-4 md:grid-cols-3 md:gap-8 lg:grid-cols-4 lg:gap-12 lg:mt-12' + 'grid grid-cols-2 mt-4 gap-4 md:grid-cols-3 md:mt-8 lg:grid-cols-4 lg:gap-8 lg:mt-12 2xl:gap-12' ), loadMore: 'border border-ui-border mt-4 px-6 py-3 inline-flex mx-auto w-auto disabled:opacity-50 disabled:cursor-not-allowed md:mt-8 lg:mt-12' diff --git a/components/search/search.tsx b/components/search/search.tsx index b882823e9..f251be743 100644 --- a/components/search/search.tsx +++ b/components/search/search.tsx @@ -1,7 +1,5 @@ 'use client'; -import Text from '@/components/ui/text'; - import { cn } from 'lib/utils'; import { useTranslations } from 'next-intl'; import SearchRoot from './search-root'; @@ -12,28 +10,19 @@ import { ReactNode } from 'react'; import { NoResults, NoResultsBoundary } from './no-result'; interface SearchProps { - title?: string; placeholder?: string; className?: string; children: ReactNode; isCategory?: boolean; } -export default function Search({ title, placeholder, children, isCategory = false }: SearchProps) { +export default function Search({ placeholder, children, isCategory = false }: SearchProps) { const t = useTranslations('search'); - console.log(isCategory); - return ( {/* Search top */}
    - {title && ( - - {title} - - )} - (({ className, ...props }, ref) => (