mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 06:18:42 +02:00
Makes the character overview (and tutorial) draggable, persisting the
{x, y, opened} in the user's settings.
- Remove margin & padding from html, body and ensure main content is
full height
- Add setting to disable progress bars
- Refactor options to use new OptionSwitch
- Add exclusions to prettierignore
- Specify line ending in prettier & gitattributes
31 lines
862 B
TypeScript
31 lines
862 B
TypeScript
import { FormControlLabel, Switch, Tooltip, Typography } from "@mui/material";
|
|
import React, { useEffect, useState } from "react";
|
|
|
|
interface IProps {
|
|
checked: boolean;
|
|
onChange: (newValue: boolean, error?: string) => void;
|
|
text: React.ReactNode;
|
|
tooltip: React.ReactNode;
|
|
}
|
|
|
|
export function OptionSwitch({ checked, onChange, text, tooltip }: IProps): React.ReactElement {
|
|
const [value, setValue] = useState(checked);
|
|
|
|
function handleSwitchChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
|
setValue(event.target.checked);
|
|
}
|
|
|
|
useEffect(() => onChange(value), [value]);
|
|
|
|
return (
|
|
<FormControlLabel
|
|
control={<Switch checked={value} onChange={handleSwitchChange} />}
|
|
label={
|
|
<Tooltip title={<Typography>{tooltip}</Typography>}>
|
|
<Typography>{text}</Typography>
|
|
</Tooltip>
|
|
}
|
|
/>
|
|
);
|
|
}
|