'Table with multiline cell
I'm trying to split a string on multi lines. What I want in a cell is that when the 50px was achieved, the string should split and go to a new row. So, the header variable should be splited on multi rows if it's bigger than 50px. How can I achieve this?
const Table = styled.table`
//margin-top: 50px;
border-collapse: collapse;
border-top: 1px solid ${LIGHT};
border-left: 1px solid ${LIGHT};
`;
const TableRow = styled.tr`
border-bottom: 1px solid ${LIGHT};
`;
const BodyCell = styled.td`
font-weight: bold;
font-family: "Roboto", sans-serif;
border-right: 1px solid ${LIGHT};
padding: 5px 15px;
max-width: 50px;
`;
export function Component(props: TableProps<String, String>) {
return (
<Table>
<tbody>
{props.header ? (
<TableRow key="header">
{props.header.map((header, cellKey) => {
return <HeaderCell key={cellKey}>{header}</HeaderCell>;
})}
</TableRow>
) : (
""
)}
</tbody>
</Table>
);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
