1
1
import React from 'react' ;
2
2
import { css , cx } from '@leafygreen-ui/emotion' ;
3
- import { spacing } from '@leafygreen-ui/tokens' ;
4
3
import { Body , Modal as LeafyGreenModal } from '../leafygreen' ;
5
4
import { useScrollbars } from '../../hooks/use-scrollbars' ;
6
5
import { withStackedComponentStyles } from '../../hooks/use-stacked-component' ;
7
6
8
- const contentStyles = css ( {
7
+ const styles = css ( {
9
8
width : '600px' ,
10
9
letterSpacing : 0 ,
11
10
padding : 0 ,
@@ -15,22 +14,9 @@ const contentStyles = css({
15
14
transform : 'none' ,
16
15
} ) ;
17
16
18
- const modalFullScreenStyles = css ( {
19
- '& > div' : {
20
- paddingTop : spacing [ 600 ] ,
21
- paddingBottom : spacing [ 600 ] ,
22
- paddingLeft : spacing [ 800 ] ,
23
- paddingRight : spacing [ 800 ] ,
24
- height : '100vh' ,
25
- maxHeight : '100vh' ,
26
- } ,
27
- } ) ;
28
-
29
- const contentFullScreenStyles = css ( {
17
+ const fullScreenStyles = css ( {
30
18
width : '100%' ,
31
19
height : '100%' ,
32
- maxHeight : '100%' ,
33
- margin : 0 ,
34
20
alignSelf : 'stretch' ,
35
21
'& > div' : {
36
22
height : '100%' ,
@@ -56,16 +42,10 @@ function UnwrappedModal({
56
42
57
43
return (
58
44
< LeafyGreenModal
59
- backdropClassName = { cx (
60
- scrollbarStyles ,
61
- fullScreen && modalFullScreenStyles ,
62
- backdropClassName
63
- ) }
64
- className = { cx (
65
- contentStyles ,
66
- fullScreen && contentFullScreenStyles ,
67
- className
68
- ) }
45
+ backdropClassName = { cx ( scrollbarStyles , backdropClassName ) }
46
+ className = { cx ( styles , className , {
47
+ [ fullScreenStyles ] : fullScreen ,
48
+ } ) }
69
49
{ ...props }
70
50
>
71
51
{ /* Rendering conditionally on `open` as a workaround for LG-5601 */ }
0 commit comments