Skip to content

Commit bd3e00a

Browse files
committed
Fix fullScreen prop on derived Modal
1 parent 264a3cd commit bd3e00a

File tree

1 file changed

+6
-26
lines changed
  • packages/compass-components/src/components/modals

1 file changed

+6
-26
lines changed

packages/compass-components/src/components/modals/modal.tsx

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import React from 'react';
22
import { css, cx } from '@leafygreen-ui/emotion';
3-
import { spacing } from '@leafygreen-ui/tokens';
43
import { Body, Modal as LeafyGreenModal } from '../leafygreen';
54
import { useScrollbars } from '../../hooks/use-scrollbars';
65
import { withStackedComponentStyles } from '../../hooks/use-stacked-component';
76

8-
const contentStyles = css({
7+
const styles = css({
98
width: '600px',
109
letterSpacing: 0,
1110
padding: 0,
@@ -15,22 +14,9 @@ const contentStyles = css({
1514
transform: 'none',
1615
});
1716

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({
3018
width: '100%',
3119
height: '100%',
32-
maxHeight: '100%',
33-
margin: 0,
3420
alignSelf: 'stretch',
3521
'& > div': {
3622
height: '100%',
@@ -56,16 +42,10 @@ function UnwrappedModal({
5642

5743
return (
5844
<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+
})}
6949
{...props}
7050
>
7151
{/* Rendering conditionally on `open` as a workaround for LG-5601 */}

0 commit comments

Comments
 (0)