From e522fe42e16d49fecfefd27f7c7592a3c90ad537 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Thu, 5 Sep 2024 15:07:29 +0700
Subject: cr - sort variant berdasarkan picelist terkecil

---
 src-migrate/modules/product-detail/components/VariantList.tsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src-migrate/modules/product-detail/components/VariantList.tsx')

diff --git a/src-migrate/modules/product-detail/components/VariantList.tsx b/src-migrate/modules/product-detail/components/VariantList.tsx
index 3d5b9b74..e7563b39 100644
--- a/src-migrate/modules/product-detail/components/VariantList.tsx
+++ b/src-migrate/modules/product-detail/components/VariantList.tsx
@@ -17,6 +17,7 @@ type Props = {
 }
 
 const VariantList = ({ variants }: Props) => {
+  const sorVariants = variants.sort((a, b) => a.price.price_discount - b.price.price_discount)
   return (
     <div className='overflow-auto'>
       <div className={style['wrapper']}>
@@ -29,7 +30,7 @@ const VariantList = ({ variants }: Props) => {
           <div className="w-3/12">Harga</div>
           <div className='w-1/12 sticky right-0 bg-gray-200'></div>
         </div>
-        {variants.map((variant) => (
+        {sorVariants.map((variant) => (
           <LazyLoadComponent key={variant.id}>
             <Row variant={variant} />
           </LazyLoadComponent>
-- 
cgit v1.2.3

