From b2a3011ef1cec412d01384271bd282dc97b25a59 Mon Sep 17 00:00:00 2001 From: StephDietz Date: Tue, 11 Jul 2023 09:34:38 -0500 Subject: [PATCH] update UI for product description --- app/product/[handle]/page.tsx | 17 +++++++++++++++-- components/cart/add-to-cart.tsx | 13 ++++++++----- components/product/gallery.tsx | 4 ++-- components/product/variant-selector.tsx | 8 ++++---- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/app/product/[handle]/page.tsx b/app/product/[handle]/page.tsx index 45286cdbe..bff48f417 100644 --- a/app/product/[handle]/page.tsx +++ b/app/product/[handle]/page.tsx @@ -2,10 +2,11 @@ import type { Metadata } from 'next'; import { notFound } from 'next/navigation'; import { Suspense } from 'react'; +import { AddToCart } from 'components/cart/add-to-cart'; import Grid from 'components/grid'; import Footer from 'components/layout/footer'; import ProductGridItems from 'components/layout/product-grid-items'; -import { AddToCart } from 'components/cart/add-to-cart'; +import Price from 'components/price'; import { Gallery } from 'components/product/gallery'; import { VariantSelector } from 'components/product/variant-selector'; import Prose from 'components/prose'; @@ -97,10 +98,22 @@ export default async function ProductPage({ params }: { params: { handle: string
+
+

{product.title}

+
+ +
+
{product.descriptionHtml ? ( - + ) : null} diff --git a/components/cart/add-to-cart.tsx b/components/cart/add-to-cart.tsx index eecee848e..b145f57a2 100644 --- a/components/cart/add-to-cart.tsx +++ b/components/cart/add-to-cart.tsx @@ -1,12 +1,12 @@ 'use client'; +import { PlusIcon } from '@heroicons/react/24/outline'; import clsx from 'clsx'; import { addItem } from 'components/cart/actions'; -import { useRouter, useSearchParams } from 'next/navigation'; -import { useEffect, useState, useTransition } from 'react'; - import LoadingDots from 'components/loading-dots'; import { ProductVariant } from 'lib/shopify/types'; +import { useRouter, useSearchParams } from 'next/navigation'; +import { useEffect, useState, useTransition } from 'react'; export function AddToCart({ variants, @@ -50,15 +50,18 @@ export function AddToCart({ }); }} className={clsx( - 'flex w-full items-center justify-center bg-black p-4 text-sm uppercase tracking-wide text-white opacity-90 hover:opacity-100 dark:bg-white dark:text-black', + 'relative flex w-full items-center justify-center rounded-full bg-blue-600 p-4 tracking-wide text-white hover:opacity-90', { 'cursor-not-allowed opacity-60': !availableForSale, 'cursor-not-allowed': isPending } )} > +
+ +
{availableForSale ? 'Add To Cart' : 'Out Of Stock'} - {isPending ? : null} + {isPending ? : null} ); } diff --git a/components/product/gallery.tsx b/components/product/gallery.tsx index 7ee154b57..be92d6498 100644 --- a/components/product/gallery.tsx +++ b/components/product/gallery.tsx @@ -51,7 +51,7 @@ export function Gallery({ )} {images.length > 1 ? ( -
+