From bab9bfaeeab2ba13bba1d7ed02e25b5384919bf9 Mon Sep 17 00:00:00 2001
From: FIN-IT_AndriFP <andrifebriyadiputra@gmail.com>
Date: Fri, 9 Jan 2026 10:57:14 +0700
Subject: (andri) fix sticky header

---
 .../product-detail/components/ProductDetail.tsx    | 46 ++++++++++++----------
 1 file changed, 25 insertions(+), 21 deletions(-)

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

diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx
index 983cb843..5a2ad093 100644
--- a/src-migrate/modules/product-detail/components/ProductDetail.tsx
+++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx
@@ -572,10 +572,9 @@ const ProductDetail = ({ product }: Props) => {
                                   {topHeaders.map((th, idx) => (
                                     <Th 
                                       key={`top-${idx}`}
-                                      // STICKY HEADER BARIS 1 
                                       position={idx === 0 ? "sticky" : "static"}
                                       left={idx === 0 ? 0 : undefined}
-                                      zIndex={idx === 0 ? 22 : 20} 
+                                      zIndex={idx === 0 ? 22 : 20}
                                       boxShadow={idx === 0 ? "2px 0 5px -2px rgba(0,0,0,0.2)" : "none"}
                                       
                                       bg="red.600" 
@@ -596,25 +595,30 @@ const ProductDetail = ({ product }: Props) => {
 
                                 {/* Baris 2: Sub Header */}
                                 <Tr>
-                                  {subHeaders.map((sub, idx) => (
-                                    <Th 
-                                      key={`sub-${idx}`}
-                                      position={idx === 0 ? "sticky" : "static"}
-                                      left={idx === 0 ? 0 : undefined}
-                                      zIndex={idx === 0 ? 21 : 1} 
-                                      boxShadow={idx === 0 ? "2px 0 5px -2px rgba(0,0,0,0.2)" : "none"}
-                                      color="white" 
-                                      textAlign="center" 
-                                      fontSize="xs"
-                                      textTransform="none" 
-                                      verticalAlign="middle"
-                                      whiteSpace="nowrap"
-                                      bg="red.600"
-                                      pt={1} pb={1}
-                                    >
-                                      {sub.label}
-                                    </Th>
-                                  ))}
+                                  {subHeaders.map((sub, idx) => { 
+                                    const isFirstHeaderGroup = topHeaders[0]?.type === 'group';
+                                    const shouldSticky = idx === 0 && isFirstHeaderGroup;
+                                    return (
+                                      <Th 
+                                        key={`sub-${idx}`}
+                                        position={shouldSticky ? "sticky" : "static"}
+                                        left={shouldSticky ? 0 : undefined}
+                                        zIndex={shouldSticky ? 21 : 1}
+                                        boxShadow={shouldSticky ? "2px 0 5px -2px rgba(0,0,0,0.2)" : "none"}
+                                        
+                                        color="white" 
+                                        textAlign="center" 
+                                        fontSize="xs"
+                                        textTransform="none" 
+                                        verticalAlign="middle"
+                                        whiteSpace="nowrap"
+                                        bg="red.600"
+                                        pt={1} pb={1}
+                                      >
+                                        {sub.label}
+                                      </Th>
+                                    );
+                                  })}
                                 </Tr>
                               </Thead>
                               
-- 
cgit v1.2.3

