diff --git a/site/components/common/Navbar/Navbar.tsx b/site/components/common/Navbar/Navbar.tsx index 177274383..263cd6cd7 100644 --- a/site/components/common/Navbar/Navbar.tsx +++ b/site/components/common/Navbar/Navbar.tsx @@ -24,7 +24,7 @@ const Navbar: FC = ({ links }) => { onClose: onCloseDrawer, } = useDisclosure() - const { locale } = useRouter() + const { locale, pathname } = useRouter() return ( <> @@ -44,7 +44,7 @@ const Navbar: FC = ({ links }) => { - {process.env.COMMERCE_SEARCH_ENABLED && ( + {process.env.COMMERCE_SEARCH_ENABLED && pathname.includes("search") && (
diff --git a/site/components/product/ProductCard/ProductCard.tsx b/site/components/product/ProductCard/ProductCard.tsx index c70461f6c..6af91c1b1 100644 --- a/site/components/product/ProductCard/ProductCard.tsx +++ b/site/components/product/ProductCard/ProductCard.tsx @@ -1,4 +1,4 @@ -import { FC } from 'react' +import { FC, useState } from 'react' import cn from 'clsx' import Link from 'next/link' import type { Product } from '@commerce/types/product' @@ -7,6 +7,8 @@ import Image, { ImageProps } from 'next/image' import WishlistButton from '@components/wishlist/WishlistButton' import usePrice from '@framework/product/use-price' import ProductTag from '../ProductTag' +import ProductCardExtended from '../ProductCardExtended/ProductCardExtended' +import { Stack, Text, Heading, Box, useColorModeValue } from '@chakra-ui/react' interface Props { className?: string @@ -37,10 +39,12 @@ const ProductCard: FC = ({ className ) + const [isHover, setIsHover] = useState(false) + return ( - - {variant === 'slim' && ( + setIsHover(false)} onMouseEnter={() => setIsHover(true)}> + {variant === 'slim' && !isHover && ( <>
{product.name} @@ -61,7 +65,7 @@ const ProductCard: FC = ({ )} - {variant === 'simple' && ( + {variant === 'simple' && !isHover && ( <> {process.env.COMMERCE_WISHLIST_ENABLED && ( = ({ variant={product.variants[0]} /> )} - {!noNameTag && ( -
-

- {product.name} -

-
- {`${price} ${product.price?.currencyCode}`} -
-
- )}
{product?.images && (
@@ -99,7 +93,7 @@ const ProductCard: FC = ({ )} - {variant === 'default' && ( + {variant === 'default' && !isHover && ( <> {process.env.COMMERCE_WISHLIST_ENABLED && ( = ({ variant={product.variants[0] as any} /> )} -
{product?.images && (
@@ -130,6 +120,55 @@ const ProductCard: FC = ({
)} + + {isHover && ( + <> + + {process.env.COMMERCE_WISHLIST_ENABLED && ( + + )} +
+ {product?.images && ( +
+ {product.name +
+ )} +
+ + + {product.name} + + + + {`${price} ${product.price?.currencyCode}`} + + + +
+ + )} +
) diff --git a/site/components/product/ProductCardExtended/ProductCardExtended.tsx b/site/components/product/ProductCardExtended/ProductCardExtended.tsx new file mode 100644 index 000000000..5fc00bd38 --- /dev/null +++ b/site/components/product/ProductCardExtended/ProductCardExtended.tsx @@ -0,0 +1,84 @@ +import { + Flex, + Box, + Image, + useColorModeValue, + Stack, + Heading, + Text, + Center + } from '@chakra-ui/react'; + import usePrice from '@framework/product/use-price' + +import type { Product } from '@commerce/types/product' +import { ImageProps } from 'next/image' +import ProductTag from '../ProductTag' +import { FC } from 'react'; + + interface Props { + product: Product + imgProps?: Omit + } + + const ProductCardExtended: FC =({ + product, + imgProps + }) => { + + const { price } = usePrice({ + amount: product.price.value, + baseAmount: product.price.retailPrice, + currencyCode: product.price.currencyCode!, + }) + + const placeholderImg = '/product-img-placeholder.svg'; + const IMAGE = product.images[0]?.url || placeholderImg + + return ( +
+ + + + + + + Brand + + + Nice Chair, pink + + + + $57 + + + $199 + + + + +
+ ); + } + + export default ProductCardExtended; \ No newline at end of file diff --git a/site/components/search.tsx b/site/components/search.tsx index 92146628c..9a3b948f3 100644 --- a/site/components/search.tsx +++ b/site/components/search.tsx @@ -168,107 +168,6 @@ export default function Search({ categories, brands }: SearchPropsType) {
- - {/* Designs */} -
-
- - - -
- -
{/* Products */}