forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModalDialog.js
More file actions
53 lines (44 loc) · 1.27 KB
/
Copy pathModalDialog.js
File metadata and controls
53 lines (44 loc) · 1.27 KB
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
44
45
46
47
48
49
50
51
52
53
import classNames from 'classnames';
import React from 'react';
import { bsClass, bsSizes, getClassSet, prefix, splitBsProps }
from './utils/bootstrapUtils';
import { Size } from './utils/StyleConfig';
const propTypes = {
/**
* A css class to apply to the Modal dialog DOM node.
*/
dialogClassName: React.PropTypes.string,
};
class ModalDialog extends React.Component {
render() {
const { dialogClassName, className, style, children, ...props } =
this.props;
const [bsProps, elementProps] = splitBsProps(props);
const bsClassName = prefix(bsProps);
const modalStyle = { display: 'block', ...style };
const dialogClasses = {
...getClassSet(bsProps),
[bsClassName]: false,
[prefix(bsProps, 'dialog')]: true,
};
return (
<div
{...elementProps}
tabIndex="-1"
role="dialog"
style={modalStyle}
className={classNames(className, bsClassName)}
>
<div className={classNames(dialogClassName, dialogClasses)}>
<div className={prefix(bsProps, 'content')} role="document">
{children}
</div>
</div>
</div>
);
}
}
ModalDialog.propTypes = propTypes;
export default bsClass('modal',
bsSizes([Size.LARGE, Size.SMALL], ModalDialog)
);