import React from 'react'; import { Card, Button, Row, Col, Typography, Space, Tag } from 'antd'; import { EditOutlined, DeleteOutlined, EyeOutlined } from '@ant-design/icons'; const { Text } = Typography; const CardList = ({ data, column, header, showPreviewModal, showEditModal, showDeleteDialog, cardColor, }) => { const getCardStyle = () => { const color = cardColor ?? '#F3EDEA'; // Orange color return { border: `2px solid ${color}`, borderRadius: '8px', textAlign: 'center', // Center text }; }; const getTitleStyle = (color) => { const backgroundColor = color ?? '#FCF2ED'; return { backgroundColor, color: '#fff', padding: '2px 8px', borderRadius: '4px', display: 'inline-block', // ganti inline-block → block width: 'fit-content', // biar lebarnya tetap menyesuaikan teks }; }; return ( {data.map((item) => ( {item[header]} } style={getCardStyle()} actions={[ showPreviewModal(item)} />, showEditModal(item)} />, showDeleteDialog(item)} />, ]} >
{column.map((itemCard, index) => ( {!itemCard.hidden && itemCard.title !== 'No' && itemCard.title !== 'Aksi' && (

{itemCard.title}:{' '} {itemCard.render ? itemCard.render( item[itemCard.dataIndex], item, index ) : item[itemCard.dataIndex] || item[itemCard.key] || '-'}

)}
))}
))}
); }; export default CardList;