refactor: put TD up back in the table
This commit is contained in:
@ -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 (
|
||||
<TD key={id}>
|
||||
<StyledClickable>
|
||||
<Link to={href}>
|
||||
<Container>{children}</Container>
|
||||
</Link>
|
||||
</TD>
|
||||
</StyledClickable>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -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) => (
|
||||
<tr key={row.id}>
|
||||
{row.getVisibleCells().map((cell) => {
|
||||
return flexRender(
|
||||
cell.column.columnDef.cell,
|
||||
cell.getContext(),
|
||||
return (
|
||||
<td key={cell.id}>
|
||||
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
||||
</td>
|
||||
);
|
||||
})}
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user