2020-03-20 14:48:46 +11:00
|
|
|
import React from "react";
|
|
|
|
|
import Modal from "react-modal";
|
|
|
|
|
import { useThemeUI, Close } from "theme-ui";
|
|
|
|
|
|
|
|
|
|
function StyledModal({ isOpen, onRequestClose, children }) {
|
|
|
|
|
const { theme } = useThemeUI();
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Modal
|
|
|
|
|
isOpen={isOpen}
|
|
|
|
|
onRequestClose={onRequestClose}
|
|
|
|
|
style={{
|
|
|
|
|
overlay: { backgroundColor: "rgba(0, 0, 0, 0.73)" },
|
|
|
|
|
content: {
|
|
|
|
|
backgroundColor: theme.colors.background,
|
|
|
|
|
top: "50%",
|
|
|
|
|
left: "50%",
|
|
|
|
|
right: "auto",
|
|
|
|
|
bottom: "auto",
|
|
|
|
|
marginRight: "-50%",
|
2020-04-09 13:39:25 +10:00
|
|
|
transform: "translate(-50%, -50%)",
|
2020-04-09 22:48:21 +10:00
|
|
|
maxHeight: "100%",
|
2020-04-09 13:39:25 +10:00
|
|
|
},
|
2020-03-20 14:48:46 +11:00
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
<Close
|
2020-03-20 20:29:35 +11:00
|
|
|
m={0}
|
2020-03-20 14:48:46 +11:00
|
|
|
sx={{ position: "absolute", top: 0, right: 0 }}
|
|
|
|
|
onClick={onRequestClose}
|
|
|
|
|
/>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default StyledModal;
|