mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-10-23 18:23:15 +02:00
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import React from "react";
|
|
import { Theme } from "@mui/material";
|
|
import makeStyles from "@mui/styles/makeStyles";
|
|
import createStyles from "@mui/styles/createStyles";
|
|
import M from "@mui/material/Modal";
|
|
import Fade from "@mui/material/Fade";
|
|
import Box from "@mui/material/Box";
|
|
|
|
const useStyles = makeStyles((theme: Theme) =>
|
|
createStyles({
|
|
modal: {
|
|
display: "flex",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
},
|
|
paper: {
|
|
backgroundColor: theme.palette.background.paper,
|
|
border: "2px solid " + theme.palette.primary.main,
|
|
boxShadow: theme.shadows[5],
|
|
padding: 2,
|
|
maxWidth: "80%",
|
|
maxHeight: "80%",
|
|
overflow: "auto",
|
|
"&::-webkit-scrollbar": {
|
|
// webkit
|
|
display: "none",
|
|
},
|
|
scrollbarWidth: "none", // firefox
|
|
},
|
|
}),
|
|
);
|
|
|
|
interface IProps {
|
|
open: boolean;
|
|
onClose: () => void;
|
|
children: JSX.Element[] | JSX.Element | React.ReactElement[] | React.ReactElement;
|
|
}
|
|
|
|
export const Modal = (props: IProps): React.ReactElement => {
|
|
const classes = useStyles();
|
|
return (
|
|
<M open={props.open} onClose={props.onClose} closeAfterTransition className={classes.modal}>
|
|
<Fade in={props.open}>
|
|
<div className={classes.paper}>
|
|
<Box sx={{ m: 2 }}>{props.children}</Box>
|
|
</div>
|
|
</Fade>
|
|
</M>
|
|
);
|
|
};
|