mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 17:53:55 +01:00
implement visibility icon toggling
This commit is contained in:
parent
8b7723338b
commit
2a52f6fa2b
@ -5,6 +5,7 @@ import Box from "@mui/material/Box";
|
|||||||
import Collapse from "@mui/material/Collapse";
|
import Collapse from "@mui/material/Collapse";
|
||||||
import Fab from "@mui/material/Fab";
|
import Fab from "@mui/material/Fab";
|
||||||
import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
|
import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
|
||||||
|
import VisibilityIcon from "@mui/icons-material/Visibility";
|
||||||
import { use } from "../Context";
|
import { use } from "../Context";
|
||||||
import { Page } from "../Router";
|
import { Page } from "../Router";
|
||||||
|
|
||||||
@ -24,13 +25,19 @@ export function Overview({ children }: IProps): React.ReactElement {
|
|||||||
const router = use.Router();
|
const router = use.Router();
|
||||||
if (router.page() === Page.BitVerse || router.page() === Page.HackingMission || router.page() === Page.Loading)
|
if (router.page() === Page.BitVerse || router.page() === Page.HackingMission || router.page() === Page.Loading)
|
||||||
return <></>;
|
return <></>;
|
||||||
|
let icon;
|
||||||
|
if (open){
|
||||||
|
icon = <VisibilityOffIcon color="primary" />;
|
||||||
|
} else {
|
||||||
|
icon = <VisibilityIcon color="primary" />;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div style={{ position: "fixed", top: 0, right: 0, zIndex: 1500 }}>
|
<div style={{ position: "fixed", top: 0, right: 0, zIndex: 1500 }}>
|
||||||
<Box display="flex" justifyContent="flex-end" flexDirection={"column"}>
|
<Box display="flex" justifyContent="flex-end" flexDirection={"column"}>
|
||||||
<Collapse in={open}>{children}</Collapse>
|
<Collapse in={open}>{children}</Collapse>
|
||||||
<Box display="flex" justifyContent="flex-end">
|
<Box display="flex" justifyContent="flex-end">
|
||||||
<Fab classes={{ root: classes.nobackground }} onClick={() => setOpen((old) => !old)}>
|
<Fab classes={{ root: classes.nobackground }} onClick={() => setOpen((old) => !old)}>
|
||||||
<VisibilityOffIcon color="primary" />
|
{icon}
|
||||||
</Fab>
|
</Fab>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
Loading…
Reference in New Issue
Block a user