on d2ca91e help sign in
bridge/src/components/L2/Modal.tsx
39 lines 725 B history raw
1import React, { MouseEvent } from 'react';
2import { Box } from '@tlon/indigo-react';
4import './Modal.scss';
6export interface ModalProps {
7 show: boolean;
8 hide: () => void;
9 hideClose?: boolean;
10 children: React.ReactNode;
13export default function Modal({
14 show,
15 hide,
16 hideClose = false,
17 children,
18}: ModalProps) {
19 const dontHide = (e: MouseEvent) => {
20 e.stopPropagation();
21 };
23 if (!show) {
24 return null;
25 }
27 return (
28 <Box className="modal" onClick={hide}>
29 <Box className="content">
30 {!hideClose && (
31 <Box className="close" onClick={hide}>
32 &#215;
33 </Box>
34 )}
35 <Box onClick={dontHide}>{children}</Box>
36 </Box>
37 </Box>
38 );