summaryrefslogtreecommitdiff
path: root/src/lib/product/components/ProductCard.jsx
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-02-22 11:03:34 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-02-22 11:03:34 +0700
commitf66b12fd1d0b83af0d7230d7b1565fbe00afbe3c (patch)
tree253dcf854a3c92e09ca846e86a09e5b4c5d16be1 /src/lib/product/components/ProductCard.jsx
parent3c559031623649a67825ff47f34512f0eb946861 (diff)
prettier
Diffstat (limited to 'src/lib/product/components/ProductCard.jsx')
-rw-r--r--src/lib/product/components/ProductCard.jsx80
1 files changed, 40 insertions, 40 deletions
diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index 9eb00ae0..8a2f1d7f 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -1,68 +1,68 @@
-import Image from "@/core/components/elements/Image/Image"
-import Link from "@/core/components/elements/Link/Link"
-import currencyFormat from "@/core/utils/currencyFormat"
-import { createSlug } from "@/core/utils/slug"
+import Image from '@/core/components/elements/Image/Image'
+import Link from '@/core/components/elements/Link/Link'
+import currencyFormat from '@/core/utils/currencyFormat'
+import { createSlug } from '@/core/utils/slug'
const ProductCard = ({ product, simpleTitle }) => {
return (
<>
- <div className="rounded shadow-sm border border-gray_r-4">
- <Link
- href={createSlug('/shop/product/', product?.name, product?.id)}
- className="border-b border-gray_r-4 relative"
+ <div className='rounded shadow-sm border border-gray_r-4'>
+ <Link
+ href={createSlug('/shop/product/', product?.name, product?.id)}
+ className='border-b border-gray_r-4 relative'
>
- <Image
+ <Image
src={product?.image}
alt={product?.name}
- className="w-full object-contain object-center h-36"
+ className='w-full object-contain object-center h-36'
/>
- { product.variantTotal > 1 && (
- <div className="absolute badge-gray bottom-1.5 left-1.5">{ product.variantTotal } Varian</div>
- ) }
+ {product.variantTotal > 1 && (
+ <div className='absolute badge-gray bottom-1.5 left-1.5'>
+ {product.variantTotal} Varian
+ </div>
+ )}
</Link>
- <div className="p-2 pb-3 text-caption-2 leading-5 bg-white">
- <Link
- href={createSlug('/shop/brands/', product?.manufacture?.name, product?.manufacture.id)}
- className="mb-1"
+ <div className='p-2 pb-3 text-caption-2 leading-5 bg-white'>
+ <Link
+ href={createSlug('/shop/brands/', product?.manufacture?.name, product?.manufacture.id)}
+ className='mb-1'
>
{product?.manufacture?.name}
</Link>
- <Link
+ <Link
href={createSlug('/shop/product/', product?.name, product?.id)}
- className={`font-medium mb-2 !text-gray_r-12 ${simpleTitle ? 'line-clamp-2' : 'line-clamp-3'}`}
+ className={`font-medium mb-2 !text-gray_r-12 ${
+ simpleTitle ? 'line-clamp-2' : 'line-clamp-3'
+ }`}
>
{product?.name}
</Link>
- { product?.lowestPrice?.discountPercentage > 0 && (
- <div className="flex gap-x-1 mb-1 items-center">
- <div className="text-gray_r-11 line-through text-[11px]">
+ {product?.lowestPrice?.discountPercentage > 0 && (
+ <div className='flex gap-x-1 mb-1 items-center'>
+ <div className='text-gray_r-11 line-through text-[11px]'>
{currencyFormat(product?.lowestPrice?.price)}
</div>
- <div className="badge-solid-red">
- {product?.lowestPrice?.discountPercentage}%
- </div>
+ <div className='badge-solid-red'>{product?.lowestPrice?.discountPercentage}%</div>
</div>
- ) }
+ )}
- <div className="text-red_r-11 font-semibold mb-2">
- { product?.lowestPrice?.priceDiscount > 0 ? currencyFormat(product?.lowestPrice?.priceDiscount) : (
- <a href="https://wa.me/">Call for price</a>
- ) }
+ <div className='text-red_r-11 font-semibold mb-2'>
+ {product?.lowestPrice?.priceDiscount > 0 ? (
+ currencyFormat(product?.lowestPrice?.priceDiscount)
+ ) : (
+ <a href='https://wa.me/'>Call for price</a>
+ )}
</div>
- { product?.stockTotal > 0 && (
- <div className="flex gap-x-1">
- <div className="badge-solid-red">
- Ready Stock
- </div>
- <div className="badge-gray">
- { product?.stockTotal > 5 ? '> 5' : '< 5' }
- </div>
+ {product?.stockTotal > 0 && (
+ <div className='flex gap-x-1'>
+ <div className='badge-solid-red'>Ready Stock</div>
+ <div className='badge-gray'>{product?.stockTotal > 5 ? '> 5' : '< 5'}</div>
</div>
- ) }
+ )}
</div>
</div>
</>
)
}
-export default ProductCard \ No newline at end of file
+export default ProductCard