From 71c18e864f8845a0915f5bd827c6be3ef2fe314e Mon Sep 17 00:00:00 2001 From: Sammy Teillet Date: Wed, 19 Apr 2023 17:10:37 +0200 Subject: [PATCH] feature: move TD creation to cells --- front/src/components/table/ClickableCell.tsx | 15 +++++--- front/src/components/table/Table.tsx | 11 +++--- front/src/pages/people/People.tsx | 38 +++++++++++--------- 3 files changed, 39 insertions(+), 25 deletions(-) diff --git a/front/src/components/table/ClickableCell.tsx b/front/src/components/table/ClickableCell.tsx index 6c5405604..7f1e9a4cb 100644 --- a/front/src/components/table/ClickableCell.tsx +++ b/front/src/components/table/ClickableCell.tsx @@ -4,18 +4,25 @@ import { Link } from 'react-router-dom'; type OwnProps = { href: string; + id: string; children?: React.ReactNode; }; +const TD = styled.td` + position: relative; +`; + const Container = styled.span` padding-left: ${(props) => props.theme.spacing(2)}; `; -function ClickableCell({ href, children }: OwnProps) { +function ClickableCell({ href, children, id }: OwnProps) { return ( - - {children} - + + + {children} + + ); } diff --git a/front/src/components/table/Table.tsx b/front/src/components/table/Table.tsx index eff7a45e3..8f909edce 100644 --- a/front/src/components/table/Table.tsx +++ b/front/src/components/table/Table.tsx @@ -88,11 +88,12 @@ function Table({ data, columns, viewName, viewIcon }: OwnProps) { {table.getRowModel().rows.map((row) => ( - {row.getVisibleCells().map((cell) => ( - - {flexRender(cell.column.columnDef.cell, cell.getContext())} - - ))} + {row.getVisibleCells().map((cell) => { + return flexRender( + cell.column.columnDef.cell, + cell.getContext(), + ); + })} ))} diff --git a/front/src/pages/people/People.tsx b/front/src/pages/people/People.tsx index 114fa3868..54d2a13ed 100644 --- a/front/src/pages/people/People.tsx +++ b/front/src/pages/people/People.tsx @@ -108,22 +108,24 @@ const columns = [ columnHelper.accessor('fullName', { header: () => , cell: (props) => ( - - - - + + + + + + ), }), columnHelper.accessor('email', { header: () => , cell: (props) => ( - + {props.row.original.email} @@ -133,7 +135,7 @@ const columns = [ columnHelper.accessor('company', { header: () => , cell: (props) => ( - + , cell: (props) => ( - + , cell: (props) => ( - + {new Intl.DateTimeFormat(undefined, { month: 'short', day: 'numeric', @@ -174,13 +176,17 @@ const columns = [ columnHelper.accessor('pipe', { header: () => , cell: (props) => ( - {props.row.original.pipe.name} + + {props.row.original.pipe.name} + ), }), columnHelper.accessor('city', { header: () => , cell: (props) => ( - {props.row.original.city} + + {props.row.original.city} + ), }), ];