From 630447a2f6a3eedcad98a86423cbaf167bdc5f34 Mon Sep 17 00:00:00 2001 From: Sammy Teillet Date: Wed, 19 Apr 2023 18:21:42 +0200 Subject: [PATCH] refactor: put TD up back in the table --- front/src/components/table/ClickableCell.tsx | 11 +++++----- front/src/components/table/Table.tsx | 11 +++++----- front/src/pages/people/People.tsx | 22 ++++++++------------ 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/front/src/components/table/ClickableCell.tsx b/front/src/components/table/ClickableCell.tsx index 53d9d08e9..515006308 100644 --- a/front/src/components/table/ClickableCell.tsx +++ b/front/src/components/table/ClickableCell.tsx @@ -4,14 +4,15 @@ import { Link } from 'react-router-dom'; type OwnProps = { href: string; - id: string; children?: React.ReactNode; }; -const TD = styled.td` +const StyledClickable = styled.div` position: relative; box-sizing: border-box; height: 32px; + display: flex; + align-items: center; ::before { content: ''; @@ -35,13 +36,13 @@ const Container = styled.span` padding-left: ${(props) => props.theme.spacing(2)}; `; -function ClickableCell({ href, children, id }: OwnProps) { +function ClickableCell({ href, children }: OwnProps) { return ( - + {children} - + ); } diff --git a/front/src/components/table/Table.tsx b/front/src/components/table/Table.tsx index 8f909edce..6652c2ad0 100644 --- a/front/src/components/table/Table.tsx +++ b/front/src/components/table/Table.tsx @@ -32,7 +32,7 @@ const StyledTable = styled.table` :last-child { border-right-color: transparent; } - :first-child { + :first-of-type { border-left-color: transparent; } } @@ -46,7 +46,7 @@ const StyledTable = styled.table` :last-child { border-right-color: transparent; } - :first-child { + :first-of-type { border-left-color: transparent; } } @@ -89,9 +89,10 @@ function Table({ data, columns, viewName, viewIcon }: OwnProps) { {table.getRowModel().rows.map((row) => ( {row.getVisibleCells().map((cell) => { - return flexRender( - cell.column.columnDef.cell, - cell.getContext(), + 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 54d2a13ed..2d1ab5048 100644 --- a/front/src/pages/people/People.tsx +++ b/front/src/pages/people/People.tsx @@ -108,24 +108,24 @@ const columns = [ columnHelper.accessor('fullName', { header: () => , cell: (props) => ( - + <> - + ), }), columnHelper.accessor('email', { header: () => , cell: (props) => ( - + {props.row.original.email} @@ -135,7 +135,7 @@ const columns = [ columnHelper.accessor('company', { header: () => , cell: (props) => ( - + , cell: (props) => ( - + , cell: (props) => ( - + {new Intl.DateTimeFormat(undefined, { month: 'short', day: 'numeric', @@ -176,17 +176,13 @@ 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} ), }), ];