From b90b4e7bccaf47872822b8cc987dc6f51c02e6f1 Mon Sep 17 00:00:00 2001 From: Hyko Date: Fri, 24 Apr 2026 17:50:41 -0400 Subject: [PATCH] refactor(ui): redesign mobile card layout in Table component - replace fixed column-slice layout with mobileHidden filter for flexible column visibility - render primary column as prominent header with semantic styling - display remaining columns in a responsive 2-column dl grid with label/value pairs - update MobileSkeletonCard to reflect new grid structure based on visible column count --- src/shared/components/Table.js | 84 ++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 40 deletions(-) diff --git a/src/shared/components/Table.js b/src/shared/components/Table.js index a30a8f5..3899da9 100644 --- a/src/shared/components/Table.js +++ b/src/shared/components/Table.js @@ -101,49 +101,53 @@ const Table = ({ return value || '-'; }; - const MobileCard = ({ item }) => ( -
-
-
- {columns.slice(0, 2).map((column) => ( -
- {renderCellContent(item, column)} -
- ))} -
-
- {columns.slice(2, 4).map((column) => ( -
{renderCellContent(item, column)}
- ))} -
+ const MobileCard = ({ item }) => { + const visible = columns.filter((col) => !col.mobileHidden); + const [primary, ...rest] = visible; + return ( +
+ {primary && ( +
+ {renderCellContent(item, primary)} +
+ )} + {rest.length > 0 && ( +
+ {rest.map((column) => ( +
+
+ {column.label} +
+
+ {renderCellContent(item, column)} +
+
+ ))} +
+ )}
- {columns.length > 4 && ( -
- {columns.slice(4).map((column) => ( -
- {column.label}: {renderCellContent(item, column)} -
- ))} -
- )} -
- ); + ); + }; - const MobileSkeletonCard = () => ( -
-
-
- - -
-
- - -
+ const MobileSkeletonCard = () => { + const visibleCount = columns.filter((col) => !col.mobileHidden).length; + const restCount = Math.min(Math.max(0, visibleCount - 1), 4); + return ( +
+ + {restCount > 0 && ( +
+ {Array.from({ length: restCount }).map((_, i) => ( +
+ + +
+ ))} +
+ )}
- -
- ); + ); + }; const getPageNumbers = () => { const pages = [];