Handle br tag in tables (#995)

This commit is contained in:
Snarling 2023-12-27 02:04:52 -05:00 committed by GitHub
parent a42b72d31a
commit 498bb6128a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

2
package-lock.json generated

@ -6,7 +6,7 @@
"packages": {
"": {
"name": "bitburner",
"version": "2.5.2",
"version": "2.6.0",
"hasInstallScript": true,
"license": "SEE LICENSE IN license.txt",
"dependencies": {

@ -80,10 +80,14 @@ const fixAlign = (align: React.CSSProperties["textAlign"]): TableCellProps["alig
export const Td = (props: React.PropsWithChildren<TableDataCellProps>): React.ReactElement => {
const classes = useStyles();
const align = fixAlign(props.style?.textAlign);
const content = props.children?.map((child, i) => {
if (child === "<br />") return <br key={i} />;
return child;
});
return (
<TableCell align={align}>
<Typography align={align} classes={{ root: classes.td }}>
{props.children}
{content}
</Typography>
</TableCell>
);
@ -92,6 +96,7 @@ export const Td = (props: React.PropsWithChildren<TableDataCellProps>): React.Re
export const Th = (props: React.PropsWithChildren<TableHeaderCellProps>): React.ReactElement => {
const classes = useStyles();
const align = fixAlign(props.style?.textAlign);
return (
<TableCell align={align}>
<Typography align={align} classes={{ root: classes.th }}>