From fbbff6a25ed39b721927a79ce905f4d1e06e522b Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Tue, 23 Dec 2025 14:44:11 +0700 Subject: (andri) fix sticky kolom pertama specs --- .../product-detail/components/ProductDetail.tsx | 198 ++++++++++++--------- 1 file changed, 118 insertions(+), 80 deletions(-) diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx index 3beb75b4..1c9c39e0 100644 --- a/src-migrate/modules/product-detail/components/ProductDetail.tsx +++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx @@ -460,88 +460,126 @@ const ProductDetail = ({ product }: Props) => { - {/* SPESIFIKASI (LOGIKA GROUPING + RATA TENGAH) */} + {/* SPESIFIKASI (LOGIKA GROUPING + RATA TENGAH + STICKY FIRST COLUMN) */} - {loadingSpecs ? ( -
- ) : specsMatrix.length > 0 ? ( - (() => { - const isSingleVariant = product.variants.length === 1; - const globalAlign = isSingleVariant ? "left" : "center"; - - return ( - - - - - {product.variants.map(v => ( - - ))} - - - - {specsMatrix.map((row, i) => { - - // CASE 1: GROUPING (Label punya ' : ') - if (row.type === 'group') { - return ( - - {/* Header Group Kiri */} - - - {/* Content Group Kanan */} - {product.variants.map(v => ( - - ))} - - ); - } - - // CASE 2: SINGLE ITEM - return ( - - - {product.variants.map(v => { - const rawValue = row.values[v.id] || '-'; - return ( - - ); - })} - - ); - })} - -
- Spesifikasi - - {isSingleVariant ? 'Detail' : (v.attributes && v.attributes.length > 0 ? v.attributes.join(' - ') : v.code)} -
{row.label} -
-
- {row.children.map((child: any, idx: number) => { - const rawVal = child.values[v.id]; - if (!rawVal || rawVal === '-') return null; - - return ( -
- - {child.label}: - - {renderSpecValue(rawVal)} -
- ); - })} -
-
-
{row.label} - {renderSpecValue(rawValue)} -
- ); - })() - ) : ( - Spesifikasi teknis belum tersedia. - )} + {loadingSpecs ? ( +
+ ) : specsMatrix.length > 0 ? ( + (() => { + const isSingleVariant = product.variants.length === 1; + const globalAlign = isSingleVariant ? "left" : "center"; + + return ( + + + + {/* 1. STICKY HEADER KOLOM PERTAMA */} + + {product.variants.map(v => ( + + ))} + + + + {specsMatrix.map((row, i) => { + + // CASE 1: GROUPING + if (row.type === 'group') { + return ( + + {/* 2. STICKY BODY KOLOM PERTAMA (GROUP) */} + + + {product.variants.map(v => ( + + ))} + + ); + } + + // CASE 2: SINGLE ITEM + return ( + + {/* 3. STICKY BODY KOLOM PERTAMA (SINGLE) */} + + + {product.variants.map(v => { + const rawValue = row.values[v.id] || '-'; + return ( + + ); + })} + + ); + })} + +
+ Spesifikasi + + {isSingleVariant ? 'Detail' : (v.attributes && v.attributes.length > 0 ? v.attributes.join(' - ') : v.code)} +
+ {row.label} + +
+
+ {row.children.map((child: any, idx: number) => { + const rawVal = child.values[v.id]; + if (!rawVal || rawVal === '-') return null; + + return ( +
+ + {child.label}: + + {renderSpecValue(rawVal)} +
+ ); + })} +
+
+
+ {row.label} + + {renderSpecValue(rawValue)} +
+ ); + })() + ) : ( + Spesifikasi teknis belum tersedia. + )}
-- cgit v1.2.3