cleaned up styles a bit
This commit is contained in:
1 parent
3acbaf576d
commit
451b3638bf
28 files changed
+864
-705
No files matched your search
@@ -0,0 +1,17 @@
|
||||
.modal--root {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 10;
|
||||
position: fixed;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.modal--root>div {
|
||||
max-width: fit-content;
|
||||
min-width: 100px;
|
||||
padding: 0.25em;
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import "./index.css";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import MuiModal from "@mui/material/Modal";
|
||||
import { FC, ReactNode } from "react";
|
||||
import { createAppUseStyles } from "styles/theme";
|
||||
|
||||
export interface ModalStyleProps {
|
||||
open: boolean;
|
||||
@@ -7,55 +9,12 @@ export interface ModalStyleProps {
|
||||
export interface Props extends ModalStyleProps {
|
||||
children: ReactNode;
|
||||
}
|
||||
const useModalStyle = createAppUseStyles<ModalStyleProps>(theme => ({
|
||||
root: ({ open }) => ({
|
||||
display: open ? 'flex' : 'none',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
zIndex: open ? 10 : -1,
|
||||
position: 'fixed',
|
||||
height: '100vh',
|
||||
width: '100vw',
|
||||
top: 0,
|
||||
left: 0,
|
||||
}),
|
||||
background: {
|
||||
zIndex: 5,
|
||||
position: 'absolute',
|
||||
height: '100vh',
|
||||
width: '100vw',
|
||||
top: 0,
|
||||
left: 0,
|
||||
backgroundColor: theme.secondaryOpaque,
|
||||
},
|
||||
inner: {
|
||||
zIndex: 10,
|
||||
maxWidth: '80vw',
|
||||
maxHeight: '90vh',
|
||||
minHeight: 'min-content',
|
||||
minWidth: '100px',
|
||||
padding: '15px',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
backgroundColor: theme.primary,
|
||||
borderSize: '1px',
|
||||
borderStyle: 'solid',
|
||||
borderColor: theme.primaryAccent,
|
||||
borderRadius: '10px',
|
||||
color: theme.primaryAccent,
|
||||
overflow: "auto",
|
||||
resize: "auto",
|
||||
}
|
||||
}));
|
||||
export const Modal: FC<Props> = ({
|
||||
children,
|
||||
...props
|
||||
}) => {
|
||||
const { classes } = useModalStyle(props);
|
||||
return <div className={classes.root}>
|
||||
<div className={classes.background} />
|
||||
<div className={classes.inner}>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
export const Modal: FC<Props> = ({ children, ...props }) => {
|
||||
return (
|
||||
<MuiModal open={props.open}>
|
||||
<div className="modal--root">
|
||||
<Paper>{children}</Paper>
|
||||
</div>
|
||||
</MuiModal>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user