Reset styles for html changelogs in getUpdateText

Adds an optional sxProps to the DialogBox component.
This commit is contained in:
Martin Fournier 2022-01-25 08:16:48 -05:00
parent c4ddb5ef64
commit 8a2cad6c4a
2 changed files with 19 additions and 2 deletions

@ -22,6 +22,7 @@ import { v1APIBreak } from "./utils/v1APIBreak";
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
import { PlayerOwnedAugmentation } from "./Augmentation/PlayerOwnedAugmentation";
import { LocationName } from "./Locations/data/LocationNames";
import { SxProps } from "@mui/system";
/* SaveObject.js
* Defines the object used to save/load games
@ -371,6 +372,18 @@ function createScamUpdateText(): void {
}
}
const resets: SxProps = {
"& h1, & h2, & h3, & h4, & p, & a, & ul": {
margin: 0,
color: Settings.theme.primary,
whiteSpace: "initial",
},
"& ul": {
paddingLeft: "1.5em",
lineHeight: 1.5,
},
};
function createNewUpdateText(): void {
setTimeout(
() =>
@ -379,6 +392,7 @@ function createNewUpdateText(): void {
"Please report any bugs/issues through the github repository " +
"or the Bitburner subreddit (reddit.com/r/bitburner).<br><br>" +
CONSTANTS.LatestUpdate,
resets,
),
1000,
);
@ -391,6 +405,7 @@ function createBetaUpdateText(): void {
"Please report any bugs/issues through the github repository (https://github.com/danielyxie/bitburner/issues) " +
"or the Bitburner subreddit (reddit.com/r/bitburner).<br><br>" +
CONSTANTS.LatestUpdate,
resets,
);
}

@ -1,11 +1,13 @@
import { AlertEvents } from "./AlertManager";
import React from "react";
import { SxProps } from "@mui/system";
import { Typography } from "@mui/material";
export function dialogBoxCreate(txt: string | JSX.Element): void {
export function dialogBoxCreate(txt: string | JSX.Element, styles?: SxProps): void {
if (typeof txt !== "string") {
AlertEvents.emit(txt);
} else {
AlertEvents.emit(<span dangerouslySetInnerHTML={{ __html: txt }} />);
AlertEvents.emit(<Typography component="span" sx={styles} dangerouslySetInnerHTML={{ __html: txt }} />);
}
}