1
1
import type { ForwardedRef } from 'react' ;
2
2
import { forwardRef , useEffect } from 'react' ;
3
3
import isPropValid from '@emotion/is-prop-valid' ;
4
+ import { css } from '@emotion/react' ;
4
5
import styled from '@emotion/styled' ;
5
6
import { motion } from 'framer-motion' ;
6
7
8
+ import { space } from 'sentry/styles/space' ;
9
+
7
10
const PANEL_WIDTH = '50vw' ;
8
11
const PANEL_HEIGHT = '50vh' ;
12
+
9
13
const INITIAL_STYLES = {
10
14
bottom : { opacity : 0 , x : 0 , y : 0 } ,
11
15
right : { opacity : 0 , x : PANEL_WIDTH , y : 0 } ,
12
16
} ;
17
+
13
18
const FINAL_STYLES = {
14
19
bottom : { opacity : 0 , x : 0 , y : PANEL_HEIGHT } ,
15
20
right : { opacity : 0 , x : PANEL_WIDTH } ,
@@ -35,6 +40,7 @@ function SlideOverPanel(
35
40
} , [ collapsed , onOpen ] ) ;
36
41
const initial = slidePosition ? INITIAL_STYLES [ slidePosition ] : INITIAL_STYLES . right ;
37
42
const final = slidePosition ? FINAL_STYLES [ slidePosition ] : FINAL_STYLES . right ;
43
+
38
44
return (
39
45
< _SlideOverPanel
40
46
ref = { ref }
@@ -61,30 +67,56 @@ const _SlideOverPanel = styled(motion.div, {
61
67
collapsed : boolean ;
62
68
slidePosition ?: 'right' | 'bottom' ;
63
69
} > `
64
- ${ p =>
65
- p . slidePosition === 'bottom'
66
- ? `
67
- width: 100%;
68
- height: ${ PANEL_HEIGHT } ;
69
- position: sticky;
70
- border-top: 1px solid ${ p . theme . border } ;
71
- `
72
- : `
73
- width: ${ PANEL_WIDTH } ;
74
- height: 100%;
75
- position: fixed;
76
- top: 0;
77
- border-left: 1px solid ${ p . theme . border } ;
78
- ` }
79
- bottom: 0;
70
+ position: fixed;
71
+
72
+ top: ${ space ( 2 ) } ;
80
73
right: 0;
74
+ bottom: ${ space ( 2 ) } ;
75
+ left: ${ space ( 2 ) } ;
76
+
77
+ overflow: auto;
78
+
79
+ z-index: ${ p => p . theme . zIndex . modal + 1 } ;
80
+
81
+ box-shadow: ${ p => p . theme . dropShadowHeavy } ;
81
82
background: ${ p => p . theme . background } ;
82
83
color: ${ p => p . theme . textColor } ;
84
+
83
85
text-align: left;
84
- z-index: ${ p => p . theme . zIndex . sidebar - 1 } ;
86
+
87
+ @media (min-width: ${ p => p . theme . breakpoints . small } ) {
88
+ ${ p =>
89
+ p . slidePosition === 'bottom'
90
+ ? css `
91
+ position : sticky;
92
+
93
+ width : 100% ;
94
+ height : ${ PANEL_HEIGHT } ;
95
+
96
+ right : 0 ;
97
+ bottom : 0 ;
98
+ left : 0 ;
99
+ `
100
+ : css `
101
+ position : fixed;
102
+
103
+ width : ${ PANEL_WIDTH } ;
104
+ height : 100% ;
105
+
106
+ top : 0 ;
107
+ right : 0 ;
108
+ bottom : 0 ;
109
+ left : auto;
110
+ ` }
111
+ }
112
+
85
113
${ p =>
86
114
p . collapsed
87
- ? 'overflow: hidden;'
88
- : `overflow-x: hidden;
89
- overflow-y: scroll;` }
115
+ ? css `
116
+ overflow : hidden;
117
+ `
118
+ : css `
119
+ overflow-x : hidden;
120
+ overflow-y : auto;
121
+ ` }
90
122
` ;
0 commit comments