From f99e0aba70efad0deb907d8e27f09fc9f527c8a4 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Fri, 17 Feb 2023 17:07:50 +0700
Subject: Refactor

---
 src/lib/product/components/ProductCard.jsx | 68 ++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 src/lib/product/components/ProductCard.jsx

(limited to 'src/lib/product/components/ProductCard.jsx')

diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
new file mode 100644
index 00000000..86ac3a64
--- /dev/null
+++ b/src/lib/product/components/ProductCard.jsx
@@ -0,0 +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"
+
+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"
+        >
+          <Image 
+            src={product?.image}
+            alt={product?.name}
+            className="w-full object-contain object-center h-36 bg-white"
+          />
+          { 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"
+          >
+            {product?.manufacture?.name}
+          </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'}`}
+          >
+            {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]">
+                {currencyFormat(product?.lowestPrice?.price)}
+              </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>
+          { 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
-- 
cgit v1.2.3


From 69f55de26319e570ce0a8c4dbe8a29cb0d0b51c5 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Sat, 18 Feb 2023 22:03:55 +0700
Subject: optimization

---
 src/lib/product/components/ProductCard.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/lib/product/components/ProductCard.jsx')

diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index 86ac3a64..9eb00ae0 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -14,7 +14,7 @@ const ProductCard = ({ product, simpleTitle }) => {
           <Image 
             src={product?.image}
             alt={product?.name}
-            className="w-full object-contain object-center h-36 bg-white"
+            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>
-- 
cgit v1.2.3


From f66b12fd1d0b83af0d7230d7b1565fbe00afbe3c Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Wed, 22 Feb 2023 11:03:34 +0700
Subject: prettier

---
 src/lib/product/components/ProductCard.jsx | 80 +++++++++++++++---------------
 1 file changed, 40 insertions(+), 40 deletions(-)

(limited to 'src/lib/product/components/ProductCard.jsx')

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
-- 
cgit v1.2.3


From 7265295454801c1d921385a4b67fb3780b46771e Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Wed, 22 Feb 2023 14:00:00 +0700
Subject: fix

---
 src/lib/product/components/ProductCard.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/lib/product/components/ProductCard.jsx')

diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index 8a2f1d7f..0fe75c56 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -6,7 +6,7 @@ import { createSlug } from '@/core/utils/slug'
 const ProductCard = ({ product, simpleTitle }) => {
   return (
     <>
-      <div className='rounded shadow-sm border border-gray_r-4'>
+      <div className='rounded shadow-sm border border-gray_r-4 h-full'>
         <Link
           href={createSlug('/shop/product/', product?.name, product?.id)}
           className='border-b border-gray_r-4 relative'
-- 
cgit v1.2.3


From 6e9b5666556fb09bb7ab92e2c62c294431751403 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Wed, 22 Feb 2023 14:02:28 +0700
Subject: fix

---
 src/lib/product/components/ProductCard.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/lib/product/components/ProductCard.jsx')

diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index 0fe75c56..dd221e4f 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -6,7 +6,7 @@ import { createSlug } from '@/core/utils/slug'
 const ProductCard = ({ product, simpleTitle }) => {
   return (
     <>
-      <div className='rounded shadow-sm border border-gray_r-4 h-full'>
+      <div className='rounded shadow-sm border border-gray_r-4 h-full bg-white'>
         <Link
           href={createSlug('/shop/product/', product?.name, product?.id)}
           className='border-b border-gray_r-4 relative'
@@ -22,7 +22,7 @@ const ProductCard = ({ product, simpleTitle }) => {
             </div>
           )}
         </Link>
-        <div className='p-2 pb-3 text-caption-2 leading-5 bg-white'>
+        <div className='p-2 pb-3 text-caption-2 leading-5'>
           <Link
             href={createSlug('/shop/brands/', product?.manufacture?.name, product?.manufacture.id)}
             className='mb-1'
-- 
cgit v1.2.3


From 8cfb615556e67408d7afb6d9694b2407447085ff Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Wed, 22 Feb 2023 23:34:50 +0700
Subject: fix

---
 src/lib/product/components/ProductCard.jsx | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

(limited to 'src/lib/product/components/ProductCard.jsx')

diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index dd221e4f..6b88a3bd 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -23,12 +23,20 @@ const ProductCard = ({ product, simpleTitle }) => {
           )}
         </Link>
         <div className='p-2 pb-3 text-caption-2 leading-5'>
-          <Link
-            href={createSlug('/shop/brands/', product?.manufacture?.name, product?.manufacture.id)}
-            className='mb-1'
-          >
-            {product?.manufacture?.name}
-          </Link>
+          {product?.manufacture?.name ? (
+            <Link
+              href={createSlug(
+                '/shop/brands/',
+                product?.manufacture?.name,
+                product?.manufacture.id
+              )}
+              className='mb-1'
+            >
+              {product.manufacture.name}
+            </Link>
+          ) : (
+            <div>-</div>
+          )}
           <Link
             href={createSlug('/shop/product/', product?.name, product?.id)}
             className={`font-medium mb-2 !text-gray_r-12 ${
-- 
cgit v1.2.3

