From 13b30c5da917264cb63f41d058f2dc66f28affcc Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Thu, 11 Dec 2025 16:30:48 +0700 Subject: (andri) fix template modal --- .../components/ProductComparisonModal.tsx | 269 +++++++++++++++++++-- 1 file changed, 250 insertions(+), 19 deletions(-) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/product-detail/components/ProductComparisonModal.tsx b/src-migrate/modules/product-detail/components/ProductComparisonModal.tsx index aa4388a6..14b177ad 100644 --- a/src-migrate/modules/product-detail/components/ProductComparisonModal.tsx +++ b/src-migrate/modules/product-detail/components/ProductComparisonModal.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { Modal, ModalOverlay, @@ -6,38 +7,268 @@ import { ModalBody, ModalCloseButton, Button, - ModalFooter, - Center, Text, - Box + Box, + Badge, + Grid, + GridItem, + Image, + Input, + InputGroup, + InputLeftElement, + VStack, + HStack, + Select, + IconButton, + Flex, + Icon, // Dibutuhkan untuk membungkus icon dari Lucide } from '@chakra-ui/react'; +// Import hanya icon standar UI dari lucide-react (pengganti @chakra-ui/icons) +import { Search } from 'lucide-react'; + +// --- Dummy Data Types --- +type Product = { + id: string; + name: string; + price: string; + originalPrice: string; + image: string; + variants: string[]; + specs: Record; +}; + type Props = { isOpen: boolean; onClose: () => void; }; +// --- Dummy Data Configuration --- +const SPEC_LABELS = [ + 'Tipe Baterai', + 'Kecepatan Tanpa Beban', + 'Torsi Maksimum', + 'Ukuran Drive', + 'Berat Bersih', + 'Garansi', +]; + +const DUMMY_PRODUCTS: (Product | null)[] = [ + { + id: '1', + name: 'TEKIRO Cordless Impact Wrench 1/2 Inch XV Brushless', + price: 'Rp 999.999', + originalPrice: 'Rp 1.500.000', + image: '/images/no-image-compare.svg', + variants: ['Unit Only', '1 Baterai Kit', '2 Baterai Kit'], + specs: { + 'Tipe Baterai': '20V Lithium-Ion', + 'Kecepatan Tanpa Beban': '0-2400 RPM', + 'Torsi Maksimum': '300 N.m', + 'Ukuran Drive': '1/2 Inch', + 'Berat Bersih': '1.5 Kg', + 'Garansi': '1 Tahun', + }, + }, + { + id: '2', + name: 'Makita Cordless Impact Wrench TW001GZ (40V)', + price: 'Rp 2.450.000', + originalPrice: 'Rp 3.000.000', + image: '/images/no-image-compare.svg', + variants: ['Unit Only', 'Full Set'], + specs: { + 'Tipe Baterai': '40V Max XGT', + 'Kecepatan Tanpa Beban': '0-2500 RPM', + 'Torsi Maksimum': '1350 N.m', + 'Ukuran Drive': '3/4 Inch', + 'Berat Bersih': '2.8 Kg', + 'Garansi': '2 Tahun', + }, + }, + { + id: '3', + name: 'DEWALT Max Brushless 1/2 High Torque Impact', + price: 'Rp 3.100.000', + originalPrice: 'Rp 3.500.000', + image: '/images/no-image-compare.svg', + variants: ['Unit Only'], + specs: { + 'Tipe Baterai': '20V XR Li-Ion', + 'Kecepatan Tanpa Beban': '0-1900 RPM', + 'Torsi Maksimum': '950 N.m', + 'Ukuran Drive': '1/2 Inch', + 'Berat Bersih': '2.6 Kg', + 'Garansi': '3 Tahun', + }, + }, + null, // Slot kosong +]; + const ProductComparisonModal = ({ isOpen, onClose }: Props) => { return ( - + - - Perbandingan Produk + + + + Bandingkan Produk + + Baru + + + + Detail Spesifikasi Produk yang kamu pilih + + - - -
- Test - Modal Berhasil Terbuka! - - Fitur komparasi produk akan muncul di sini nanti. - -
-
- - - + + {/* Main Grid Layout: 5 Columns */} + + + {/* Cell 1: Top Left Empty Space */} + + + {/* Cell 2-5: Render Products */} + {DUMMY_PRODUCTS.map((product, index) => ( + + {product ? ( + // --- KARTU PRODUK TERISI --- + + {/* Search Bar (Pakai Icon Lucide) */} + + + + + + + + {/* Gambar Produk */} + + {product.name} + + + {/* Harga */} + + + {product.price} + + + {product.originalPrice} + + + + {/* Nama Produk */} + + {product.name} + + + {/* Dropdown Varian */} + + + {/* Tombol Aksi (Pakai SVG Custom untuk Keranjang) */} + + } + variant="outline" + colorScheme="red" + size="sm" + w="40px" + /> + + + + ) : ( + // --- SLOT KOSONG --- + + + + + + + + + + {/* Placeholder Image (SVG Custom) */} + + + Produk belum ditambahkan + + + + )} + + ))} + + {/* --- SEPARATOR HEADER SPEC --- */} + + + Spesifikasi Teknis + Detail Spesifikasi Produk yang kamu pilih + + + + {/* --- TABLE SPEC --- */} + {SPEC_LABELS.map((label, rowIndex) => ( + + {/* Kolom Label */} + + + {label} + + + + {/* Kolom Value */} + {DUMMY_PRODUCTS.map((product, colIndex) => ( + + + {product ? (product.specs[label] || '-') : '-'} + + + ))} + + ))} + + +
); -- cgit v1.2.3