mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 12:15:44 +01:00
Handle br tag in tables (#995)
This commit is contained in:
parent
a42b72d31a
commit
498bb6128a
2
package-lock.json
generated
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 }}>
|
||||
|
Loading…
Reference in New Issue
Block a user