feature: move TD creation to cells
This commit is contained in:
@ -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 (
|
||||
<Link to={href}>
|
||||
<Container>{children}</Container>
|
||||
</Link>
|
||||
<TD key={id}>
|
||||
<Link to={href}>
|
||||
<Container>{children}</Container>
|
||||
</Link>
|
||||
</TD>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -88,11 +88,12 @@ function Table({ data, columns, viewName, viewIcon }: OwnProps) {
|
||||
<tbody>
|
||||
{table.getRowModel().rows.map((row) => (
|
||||
<tr key={row.id}>
|
||||
{row.getVisibleCells().map((cell) => (
|
||||
<td key={cell.id}>
|
||||
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
||||
</td>
|
||||
))}
|
||||
{row.getVisibleCells().map((cell) => {
|
||||
return flexRender(
|
||||
cell.column.columnDef.cell,
|
||||
cell.getContext(),
|
||||
);
|
||||
})}
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user