diff --git a/components/product/ProductCard/ProductCard.tsx b/components/product/ProductCard/ProductCard.tsx index b6327dccb..febb14b28 100644 --- a/components/product/ProductCard/ProductCard.tsx +++ b/components/product/ProductCard/ProductCard.tsx @@ -6,7 +6,7 @@ import s from './ProductCard.module.css' import Image, { ImageProps } from 'next/image' import WishlistButton from '@components/wishlist/WishlistButton' import usePrice from '@framework/product/use-price' - +import ProductTag from '../ProductTag' interface Props { className?: string product: Product @@ -104,14 +104,10 @@ const ProductCard: FC = ({ variant={product.variants[0] as any} /> )} -
-

- {product.name} -

-
- {`${price} ${product.price?.currencyCode}`} -
-
+
{product?.images && ( { +interface ProductSliderProps { + children: React.ReactNode[] + className?: string +} + +const ProductSlider: React.FC = ({ + children, + className = '', +}) => { const [currentSlide, setCurrentSlide] = useState(0) const [isMounted, setIsMounted] = useState(false) const sliderContainerRef = useRef(null) @@ -77,7 +85,7 @@ const ProductSlider: FC = ({ children }) => { const onNext = React.useCallback(() => slider.next(), [slider]) return ( -
+
= ({ + name, + price, + className = '', + fontSize = 32, +}) => { + return ( +
+

+ + {name} + +

+
{price}
+
+ ) +} + +export default ProductTag diff --git a/components/product/ProductTag/index.ts b/components/product/ProductTag/index.ts new file mode 100644 index 000000000..cb345e8bd --- /dev/null +++ b/components/product/ProductTag/index.ts @@ -0,0 +1 @@ +export { default } from './ProductTag' diff --git a/components/product/ProductView/ProductView.module.css b/components/product/ProductView/ProductView.module.css index b6ecc2b77..0b3ebf564 100644 --- a/components/product/ProductView/ProductView.module.css +++ b/components/product/ProductView/ProductView.module.css @@ -8,30 +8,6 @@ min-height: 500px; } -.header { - @apply transition-colors ease-in-out duration-500 - absolute top-0 left-0 z-20 pr-16; -} - -.header .name { - @apply pt-0 max-w-full w-full leading-extra-loose; - font-size: 2rem; - letter-spacing: 0.4px; -} - -.header .name span { - @apply py-4 px-6 bg-primary text-primary font-bold; - font-size: inherit; - letter-spacing: inherit; - box-decoration-break: clone; - -webkit-box-decoration-break: clone; -} - -.header .price { - @apply pt-2 px-6 pb-4 text-sm bg-primary text-accent-9 - font-semibold inline-block tracking-wide; -} - .sidebar { @apply flex flex-col col-span-1 mx-auto max-w-8xl px-6 py-6 w-full h-full; } diff --git a/components/product/ProductView/ProductView.tsx b/components/product/ProductView/ProductView.tsx index 57a045644..f689030d6 100644 --- a/components/product/ProductView/ProductView.tsx +++ b/components/product/ProductView/ProductView.tsx @@ -9,6 +9,7 @@ import { WishlistButton } from '@components/wishlist' import { ProductSlider, ProductCard } from '@components/product' import { Container, Text } from '@components/ui' import ProductSidebar from '../ProductSidebar' +import ProductTag from '../ProductTag' interface ProductViewProps { product: Product relatedProducts: Product[] @@ -23,35 +24,14 @@ const ProductView: FC = ({ product, relatedProducts }) => { return ( <> -
-
-

- {product.name} -

-
- {`${price} ${product.price?.currencyCode}`} -
-
- +
{product.images.map((image, i) => ( @@ -105,6 +85,23 @@ const ProductView: FC = ({ product, relatedProducts }) => {
+ ) }