@@ -4,7 +4,7 @@ import { memo, useMemo, useState } from 'react';
4
4
import { GrafanaTheme2 , isDateTime , rangeUtil , RawTimeRange , TimeOption , TimeRange , TimeZone } from '@grafana/data' ;
5
5
import { selectors } from '@grafana/e2e-selectors' ;
6
6
7
- import { useStyles2 , useTheme2 } from '../../../themes' ;
7
+ import { stylesFactory , useStyles2 , useTheme2 } from '../../../themes' ;
8
8
import { getFocusStyles } from '../../../themes/mixins' ;
9
9
import { t , Trans } from '../../../utils/i18n' ;
10
10
import { FilterInput } from '../../FilterInput/FilterInput' ;
@@ -79,11 +79,6 @@ export const TimePickerContentWithScreenSize = (props: PropsWithScreenSize) => {
79
79
return (
80
80
< div id = "TimePickerContent" className = { cx ( styles . container , className ) } >
81
81
< div className = { styles . body } >
82
- { isFullscreen && (
83
- < div className = { styles . leftSide } >
84
- < FullScreenForm { ...props } historyOptions = { historyOptions } />
85
- </ div >
86
- ) }
87
82
{ ( ! isFullscreen || ! hideQuickRanges ) && (
88
83
< div className = { styles . rightSide } >
89
84
< div className = { styles . timeRangeFilter } >
@@ -102,6 +97,11 @@ export const TimePickerContentWithScreenSize = (props: PropsWithScreenSize) => {
102
97
</ div >
103
98
</ div >
104
99
) }
100
+ { isFullscreen && (
101
+ < div className = { styles . leftSide } >
102
+ < FullScreenForm { ...props } historyOptions = { historyOptions } />
103
+ </ div >
104
+ ) }
105
105
</ div >
106
106
{ ! hideTimeZone && isFullscreen && (
107
107
< TimePickerFooter
@@ -193,10 +193,7 @@ const FullScreenForm = (props: FormProps) => {
193
193
className = { styles . container }
194
194
style = { {
195
195
height : '100%' ,
196
- display : 'flex' ,
197
- flexDirection : 'column' ,
198
- justifyContent : 'center' ,
199
- alignItems : 'center' ,
196
+ padding : '25px' ,
200
197
} }
201
198
>
202
199
< div className = { styles . title } data-testid = { selectors . components . TimePicker . absoluteTimeRangeTitle } >
@@ -278,54 +275,45 @@ const useTimeOption = (raw: RawTimeRange, quickOptions: TimeOption[]): TimeOptio
278
275
} , [ raw , quickOptions ] ) ;
279
276
} ;
280
277
281
- const getStyles = (
282
- theme : GrafanaTheme2 ,
283
- isReversed ?: boolean ,
284
- hideQuickRanges ?: boolean ,
285
- isContainerTall ?: boolean ,
286
- isFullscreen ?: boolean
287
- ) => ( {
288
- container : css ( {
289
- background : theme . colors . background . primary ,
290
- boxShadow : theme . shadows . z3 ,
291
- width : `${ isFullscreen ? '546px' : '262px' } ` ,
292
- borderRadius : theme . shape . radius . default ,
293
- border : `1px solid ${ theme . colors . border . weak } ` ,
294
- [ `${ isReversed ? 'left' : 'right' } ` ] : 0 ,
295
- display : 'flex' ,
296
- flexDirection : 'column' ,
297
- } ) ,
298
- body : css ( {
299
- display : 'flex' ,
300
- flexDirection : 'row-reverse' ,
301
- height : `${ isContainerTall ? '381px' : '217px' } ` ,
302
- maxHeight : '100vh' ,
303
- } ) ,
304
- leftSide : css ( {
305
- display : 'flex' ,
306
- flexDirection : 'column' ,
307
- borderRight : `${ isReversed ? 'none' : `1px solid ${ theme . colors . border . weak } ` } ` ,
308
- width : `${ ! hideQuickRanges ? '60%' : '100%' } ` ,
309
- overflow : 'auto' ,
310
- scrollbarWidth : 'thin' ,
311
- order : isReversed ? 1 : 0 ,
312
- } ) ,
313
- rightSide : css ( {
314
- width : `${ isFullscreen ? '40%' : '100%' } ; !important` ,
315
- borderRight : isReversed ? `1px solid ${ theme . colors . border . weak } ` : 'none' ,
316
- display : 'flex' ,
317
- flexDirection : 'column' ,
318
- } ) ,
319
- timeRangeFilter : css ( {
320
- padding : theme . spacing ( 1 ) ,
321
- } ) ,
322
- spacing : css ( {
323
- marginTop : '16px' ,
324
- } ) ,
325
- scrollContent : css ( {
326
- overflowY : 'auto' ,
327
- scrollbarWidth : 'thin' ,
328
- } ) ,
278
+ const getStyles = stylesFactory ( ( theme : GrafanaTheme2 , isReversed , hideQuickRanges , isContainerTall , isFullscreen ) => {
279
+ return {
280
+ container : css `
281
+ background : ${ theme . colors . background . primary } ;
282
+ box-shadow : ${ theme . shadows . z3 } ;
283
+ position : absolute;
284
+ z-index : ${ theme . zIndex . dropdown } ;
285
+ width : ${ isFullscreen ? '546px' : '262px' } ;
286
+ top : 116% ;
287
+ border-radius : 2px ;
288
+ border : 1px solid ${ theme . colors . border . weak } ;
289
+ ${ isReversed ? 'left' : 'right' } : 0;
290
+ ` ,
291
+ body : css `
292
+ dis play: flex;
293
+ flex- direction: row- reverse;
294
+ height: ${ isContainerTall ? '281px' : '217px' } ;
295
+ ` ,
296
+ leftSide : css `
297
+ dis play: flex;
298
+ flex- direction: column;
299
+ bor der- right: ${ isReversed ? 'none' : `1px solid ${ theme . colors . border . weak } ` } ;
300
+ width: ${ ! hideQuickRanges ? '50%' : '100%' } ;
301
+ overflow: hidden;
302
+ or der: ${ isReversed ? 1 : 0 } ;
303
+ ` ,
304
+ rightSide : css `
305
+ width: ${ isFullscreen ? '50%' : '100%' } ; !important ;
306
+ bor der- right: ${ isReversed ? `1px solid ${ theme . colors . border . weak } ` : 'none' } ;
307
+ dis play: flex;
308
+ flex- direction: column;
309
+ ` ,
310
+ timeRangeFilter : css `
311
+ padding: ${ theme . spacing ( 1 ) } ;
312
+ ` ,
313
+ spacing : css `
314
+ margin- to p: 16px;
315
+ ` ,
316
+ } ;
329
317
} ) ;
330
318
331
319
const getNarrowScreenStyles = ( theme : GrafanaTheme2 ) => ( {
0 commit comments