aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/components/Modal.js
blob: 50516d0563fe209858553e28abf336f4e6db19bb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React from 'react';
import PropTypes from 'prop-types';

import Icon from './Icon';

function Modal(props) {
    // The gray background
    const backdropStyle = {
        position: 'fixed',
        top: 0,
        bottom: 0,
        left: 0,
        right: 0,
        backgroundColor: 'rgba(0, 0, 0, 0.3)',
        padding: 50
    };
    return props.show ? (
        <div id="dialogt" style={backdropStyle}>
            <div id="dialogw">
                <div id="dialog_header">
                    <div id="dialogc" onClick={props.onClose}>
                        <Icon name="ei-close" size="s" />
                    </div>
                </div>
                {props.children}
            </div>
        </div>
    ) : (null);
}

export default React.memo(Modal);

Modal.propTypes = {
    onClose: PropTypes.func.isRequired,
    show: PropTypes.bool,
    children: PropTypes.node
};