aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/components/Modal.js
blob: 971efe9102840cd9f18fa76764f9250c012034eb (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
38
39
40
41
42
43
import React from 'react';
import PropTypes from 'prop-types';

import Icon from './Icon';

export default class Modal extends React.Component {
    render() {
        // Render nothing if the "show" prop is false
        if (!this.props.show) {
            return null;
        }

        // 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 (
            <div id="dialogt" style={backdropStyle}>
                <div id="dialogw">
                    <div id="dialog_header">
                        <div id="dialogc" onClick={this.props.onClose}>
                            <Icon name="ei-close" size="s" />
                        </div>
                    </div>
                    {this.props.children}
                </div>
            </div>
        );
    }
}

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