File tree Expand file tree Collapse file tree 3 files changed +88
-1
lines changed Expand file tree Collapse file tree 3 files changed +88
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ const Modal = props => {
32
32
style,
33
33
zindex,
34
34
zIndex,
35
+ dialogStyle,
36
+ dialog_style,
37
+ contentStyle,
38
+ content_style,
35
39
...otherProps
36
40
} = props ;
37
41
@@ -45,6 +49,8 @@ const Modal = props => {
45
49
< RBModal
46
50
animation = { fade }
47
51
dialogAs = { tag }
52
+ dialogStyle = { dialog_style || dialogStyle }
53
+ contentStyle = { content_style || contentStyle }
48
54
dialogClassName = { class_name || className }
49
55
className = { modal_class_name || modalClassName }
50
56
contentClassName = { content_class_name || contentClassName }
@@ -87,6 +93,26 @@ Modal.propTypes = {
87
93
*/
88
94
style : PropTypes . object ,
89
95
96
+ /**
97
+ * Inline CSS styles to apply to the dialog
98
+ */
99
+ dialog_style : PropTypes . object ,
100
+
101
+ /**
102
+ * Inline CSS styles to apply to the dialog
103
+ */
104
+ dialogStyle : PropTypes . object ,
105
+
106
+ /**
107
+ * Inline CSS styles to apply to the content
108
+ */
109
+ content_style : PropTypes . object ,
110
+
111
+ /**
112
+ * Inline CSS styles to apply to the content
113
+ */
114
+ contentStyle : PropTypes . object ,
115
+
90
116
/**
91
117
* Often used with CSS to style elements with common properties.
92
118
*/
Original file line number Diff line number Diff line change @@ -18,9 +18,10 @@ import BaseModal from '@restart/ui/Modal';
18
18
import { getSharedManager } from 'react-bootstrap/BootstrapModalManager' ;
19
19
import Fade from 'react-bootstrap/Fade' ;
20
20
import ModalContext from 'react-bootstrap/ModalContext' ;
21
- import ModalDialog from 'react-bootstrap/ModalDialog' ;
22
21
import { useBootstrapPrefix , useIsRTL } from 'react-bootstrap/ThemeProvider' ;
23
22
23
+ import ModalDialog from './ModalDialog' ;
24
+
24
25
const defaultProps = {
25
26
show : false ,
26
27
backdrop : true ,
@@ -51,6 +52,8 @@ const Modal = React.forwardRef(
51
52
dialogClassName,
52
53
contentClassName,
53
54
children,
55
+ dialogStyle,
56
+ contentStyle,
54
57
dialogAs : Dialog ,
55
58
'data-bs-theme' : dataBsTheme ,
56
59
'aria-labelledby' : ariaLabelledby ,
@@ -271,6 +274,8 @@ const Modal = React.forwardRef(
271
274
onMouseDown = { handleDialogMouseDown }
272
275
className = { dialogClassName }
273
276
contentClassName = { contentClassName }
277
+ style = { dialogStyle }
278
+ contentStyle = { contentStyle }
274
279
>
275
280
{ children }
276
281
</ Dialog >
Original file line number Diff line number Diff line change
1
+ // vendored from React-Bootstrap to allow us to set content style
2
+ // https://github.com/react-bootstrap/react-bootstrap/blob/be23c304fa40ddb209919b0faac1e5dd8cef53ad/src/ModalDialog.tsx
3
+ import React from 'react' ;
4
+
5
+ import classNames from 'classnames' ;
6
+ import { useBootstrapPrefix } from 'react-bootstrap/ThemeProvider' ;
7
+
8
+ const ModalDialog = React . forwardRef (
9
+ (
10
+ {
11
+ bsPrefix,
12
+ className,
13
+ contentClassName,
14
+ centered,
15
+ size,
16
+ fullscreen,
17
+ children,
18
+ scrollable,
19
+ contentStyle,
20
+ ...props
21
+ } ,
22
+ ref
23
+ ) => {
24
+ bsPrefix = useBootstrapPrefix ( bsPrefix , 'modal' ) ;
25
+ const dialogClass = `${ bsPrefix } -dialog` ;
26
+
27
+ const fullScreenClass =
28
+ typeof fullscreen === 'string'
29
+ ? `${ bsPrefix } -fullscreen-${ fullscreen } `
30
+ : `${ bsPrefix } -fullscreen` ;
31
+
32
+ return (
33
+ < div
34
+ { ...props }
35
+ ref = { ref }
36
+ className = { classNames (
37
+ dialogClass ,
38
+ className ,
39
+ size && `${ bsPrefix } -${ size } ` ,
40
+ centered && `${ dialogClass } -centered` ,
41
+ scrollable && `${ dialogClass } -scrollable` ,
42
+ fullscreen && fullScreenClass
43
+ ) }
44
+ >
45
+ < div
46
+ className = { classNames ( `${ bsPrefix } -content` , contentClassName ) }
47
+ style = { contentStyle }
48
+ >
49
+ { children }
50
+ </ div >
51
+ </ div >
52
+ ) ;
53
+ }
54
+ ) ;
55
+
56
+ export default ModalDialog ;
You can’t perform that action at this time.
0 commit comments