From 4a58bb303ce8dadc6b9d56c7558539c69d3fdb01 Mon Sep 17 00:00:00 2001
From: FIN-IT_AndriFP <andrifebriyadiputra@gmail.com>
Date: Thu, 29 Jan 2026 16:24:11 +0700
Subject: (andri) fix table spec jika attribute mengandung html

---
 .../components/ProductComparisonModal.tsx          | 72 +++++++++++++++++++---
 1 file changed, 65 insertions(+), 7 deletions(-)

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

diff --git a/src-migrate/modules/product-detail/components/ProductComparisonModal.tsx b/src-migrate/modules/product-detail/components/ProductComparisonModal.tsx
index b836c892..260b6713 100644
--- a/src-migrate/modules/product-detail/components/ProductComparisonModal.tsx
+++ b/src-migrate/modules/product-detail/components/ProductComparisonModal.tsx
@@ -60,7 +60,8 @@ const formatPrice = (price: number) => {
 
 const renderSpecValue = (val: any) => {
   if (!val || val === '-') return '-';
-  return String(val).replace(/<[^>]*>?/gm, '');
+  // return String(val).replace(/<[^>]*>?/gm, '');
+  return String(val);
 };
 
 const extractAttribute = (item: any) => {
@@ -777,11 +778,38 @@ const ProductComparisonModal = ({ isOpen, onClose, mainProduct, selectedVariant
                                     {isItemLoading ? (
                                         <Spinner size="xs" color="red.500" />
                                     ) : (
-                                        <Text fontWeight="semibold" fontSize="12px" color="gray.800" textAlign="center" lineHeight="shorter">
-                                            {renderSpecValue(val)}
-                                        </Text>
+                                        <Box 
+                                            fontSize="12px" 
+                                            fontWeight="semibold" 
+                                            color="gray.800" 
+                                            w="100%"
+                                            textAlign="center"
+                                            sx={{
+                                                '& ul, & ol': { 
+                                                    textAlign: 'center', 
+                                                    paddingLeft: '1.2rem', 
+                                                    listStylePosition: 'outside',
+                                                    margin: 0,
+                                                    width: '100%'
+                                                },
+                                                '& li': { 
+                                                    textAlign: 'center',
+                                                    marginBottom: '4px',
+                                                    fontWeight: 'normal'
+                                                },
+                                                '& strong': {
+                                                    display: 'block', 
+                                                    marginBottom: '2px' 
+                                                },
+                                                '& p': { 
+                                                    textAlign: 'center', 
+                                                    margin: 0 
+                                                }
+                                            }}
+                                            dangerouslySetInnerHTML={{ __html: renderSpecValue(val) }} 
+                                        />
                                     )}
-                                    <Text fontSize="10px" color="gray.600" fontWeight="normal" textAlign="center">
+                                    <Text fontSize="10px" color="gray.600" fontWeight="bold" textAlign="center">
                                        {row.label}
                                     </Text>
                                  </VStack>
@@ -948,14 +976,44 @@ const ProductComparisonModal = ({ isOpen, onClose, mainProduct, selectedVariant
                         py={3} px={2}
                         borderBottom="1px solid" borderColor="gray.100"
                         bg={rowIndex % 2 !== 0 ? "white" : "gray.50"}
-                        display="flex" alignItems="center" justifyContent="center" textAlign="center"
+                        display="flex" 
+                        alignItems="center" 
+                        justifyContent="center" 
+                        textAlign="center"
                         opacity={isLoadingMatrix ? 0.6 : 1}
                         transition="opacity 0.2s"
                       >
                         {isLoadingMatrix && product && !row.values[String(product.sku)] ? (
                           <Spinner size="xs" color="gray.400" />
                         ) : (
-                          <Text fontSize="sm" color="gray.600">{renderSpecValue(val)}</Text>
+                          <Box 
+                            fontSize="sm" 
+                            color="gray.600"
+                            w="100%"
+                            sx={{
+                              '& ul, & ol': { 
+                                textAlign: 'center', 
+                                paddingLeft: '1.2rem', 
+                                listStylePosition: 'outside',
+                                margin: 0,
+                                width: '100%'
+                                },
+                              '& li': { 
+                                textAlign: 'center',
+                                marginBottom: '4px',
+                                fontWeight: 'normal'
+                                },
+                              '& strong': {
+                                display: 'block', 
+                                marginBottom: '2px' 
+                              },
+                              '& p': { 
+                                textAlign: 'center', 
+                                margin: 0 
+                              }
+                            }}
+                            dangerouslySetInnerHTML={{ __html: renderSpecValue(val) }} 
+                          />
                         )}
                       </GridItem>
                     );
-- 
cgit v1.2.3

