mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 12:45:45 +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": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "bitburner",
|
"name": "bitburner",
|
||||||
"version": "2.5.2",
|
"version": "2.6.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "SEE LICENSE IN license.txt",
|
"license": "SEE LICENSE IN license.txt",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -80,10 +80,14 @@ const fixAlign = (align: React.CSSProperties["textAlign"]): TableCellProps["alig
|
|||||||
export const Td = (props: React.PropsWithChildren<TableDataCellProps>): React.ReactElement => {
|
export const Td = (props: React.PropsWithChildren<TableDataCellProps>): React.ReactElement => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const align = fixAlign(props.style?.textAlign);
|
const align = fixAlign(props.style?.textAlign);
|
||||||
|
const content = props.children?.map((child, i) => {
|
||||||
|
if (child === "<br />") return <br key={i} />;
|
||||||
|
return child;
|
||||||
|
});
|
||||||
return (
|
return (
|
||||||
<TableCell align={align}>
|
<TableCell align={align}>
|
||||||
<Typography align={align} classes={{ root: classes.td }}>
|
<Typography align={align} classes={{ root: classes.td }}>
|
||||||
{props.children}
|
{content}
|
||||||
</Typography>
|
</Typography>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
);
|
);
|
||||||
@ -92,6 +96,7 @@ export const Td = (props: React.PropsWithChildren<TableDataCellProps>): React.Re
|
|||||||
export const Th = (props: React.PropsWithChildren<TableHeaderCellProps>): React.ReactElement => {
|
export const Th = (props: React.PropsWithChildren<TableHeaderCellProps>): React.ReactElement => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const align = fixAlign(props.style?.textAlign);
|
const align = fixAlign(props.style?.textAlign);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableCell align={align}>
|
<TableCell align={align}>
|
||||||
<Typography align={align} classes={{ root: classes.th }}>
|
<Typography align={align} classes={{ root: classes.th }}>
|
||||||
|
Loading…
Reference in New Issue
Block a user