on master help sign in
bridge/src/components/L2/Modal.tsx
41 lines 793 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 small?: boolean;
11 children: React.ReactNode;
14export default function Modal({
15 show,
16 hide,
17 hideClose = false,
18 small = false,
19 children,
20}: ModalProps) {
21 const dontHide = (e: MouseEvent) => {
22 e.stopPropagation();
23 };
25 if (!show) {
26 return null;
27 }
29 return (
30 <Box className={`modal${small ? ' modal-small' : ''}`} onClick={hide}>
31 <Box className="content">
32 {!hideClose && (
33 <Box className="close" onClick={hide}>
34 &#215;
35 </Box>
36 )}
37 <Box onClick={dontHide}>{children}</Box>
38 </Box>
39 </Box>
40 );