feat: add custom card component for sparepart display in ListSparepart

This commit is contained in:
2025-11-25 16:49:46 +07:00
parent 7e5105392c
commit 309d191bce
3 changed files with 130 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ const TableList = memo(function TableList({
fieldColor,
firstLoad = true,
columnDynamic = false,
cardComponent, // New prop for custom card component
}) {
const [gridLoading, setGridLoading] = useState(false);
@@ -142,6 +143,9 @@ const TableList = memo(function TableList({
const isMobile = !screens.md; // kalau kurang dari md (768px) dianggap mobile
// Use the custom card component if provided, otherwise default to CardList
const CardViewComponent = cardComponent || CardList;
return (
<div>
<Segmented
@@ -153,7 +157,7 @@ const TableList = memo(function TableList({
onChange={setViewMode}
/>
{(isMobile && mobile) || viewMode === 'card' ? (
<CardList
<CardViewComponent
cardColor={cardColor}
fieldColor={fieldColor}
data={data}
@@ -200,3 +204,4 @@ const TableList = memo(function TableList({
});
export default TableList;