1
- import { css } from '@emotion/css' ;
1
+ // import { css } from '@emotion/css';
2
2
import React , { CSSProperties , FunctionComponent , PropsWithChildren , ReactElement , useMemo } from 'react' ;
3
- import { Stack } from '@mui/material' ;
4
3
// eslint-disable-next-line no-restricted-imports
5
4
import { useSelector } from 'react-redux' ;
6
5
7
- import { TypedVariableModel , VariableHide } from '@grafana/data' ;
8
6
import { selectors } from '@grafana/e2e-selectors' ;
9
7
import { Tooltip } from '@grafana/ui' ;
10
8
import { FnGlobalState } from 'app/core/reducers/fn-slice' ;
11
9
import type { StoreState } from 'app/types' ;
12
10
13
11
import { variableAdapters } from '../adapters' ;
14
- import { VARIABLE_PREFIX } from '../constants ' ;
12
+ import { VariableHide , VariableModel } from '../types ' ;
15
13
16
14
interface Props {
17
- variable : TypedVariableModel ;
15
+ variable : VariableModel ;
18
16
readOnly ?: boolean ;
19
17
}
20
18
21
- const renderWrapperStyle = css `
22
- & button ,
23
- & span ,
24
- & label ,
25
- & input {
26
- height : 24px ;
27
- font-size : 12px ;
28
- line-height : 24px ;
29
- align-self : center;
30
- }
31
- ` ;
19
+ // not using this style for now.
20
+ // const renderWrapperStyle = css`
21
+ // & button,
22
+ // & span,
23
+ // & label,
24
+ // & input {
25
+ // height: 35px;
26
+ // font-size: 14px;
27
+ // }
28
+
29
+ // /* Center align filter picker buttons */
30
+ // & button {
31
+ // margin-top: 2px;
32
+ // }
33
+
34
+ // /* Adhoc filter: Disable green border and make input height similar to others */
35
+ // & div[class*='input-wrapper'] {
36
+ // min-height: 0 !important;
37
+ // box-shadow: none !important;
38
+ // }
39
+ // `;
32
40
33
41
export const PickerRenderer : FunctionComponent < Props > = ( props ) => {
34
42
const PickerToRender = useMemo ( ( ) => variableAdapters . get ( props . variable . type ) . picker , [ props . variable ] ) ;
@@ -38,25 +46,25 @@ export const PickerRenderer: FunctionComponent<Props> = (props) => {
38
46
}
39
47
40
48
return (
41
- < Stack gap = { 0 } >
49
+ < div className = "gf-form" >
42
50
< PickerLabel variable = { props . variable } />
43
51
{ props . variable . hide !== VariableHide . hideVariable && PickerToRender && (
44
- < div className = { renderWrapperStyle } >
52
+ < div >
45
53
< PickerToRender variable = { props . variable } readOnly = { props . readOnly ?? false } />
46
54
</ div >
47
55
) }
48
- </ Stack >
56
+ </ div >
49
57
) ;
50
58
} ;
51
59
52
60
const COMMON_PICKER_LABEL_STYLE : CSSProperties = {
53
- borderRadius : '2px' ,
54
61
border : 'none' ,
55
- fontWeight : 400 ,
56
- fontSize : '12px ' ,
62
+ fontWeight : 500 ,
63
+ fontSize : '14px ' ,
57
64
padding : '3px 6px' ,
58
65
letterSpacing : '0.15px' ,
59
66
height : '24px' ,
67
+ marginTop : '2px' ,
60
68
} ;
61
69
62
70
function PickerLabel ( { variable } : PropsWithChildren < Props > ) : ReactElement | null {
@@ -66,22 +74,17 @@ function PickerLabel({ variable }: PropsWithChildren<Props>): ReactElement | nul
66
74
const fnLabelStyle = useMemo (
67
75
( ) => ( {
68
76
...COMMON_PICKER_LABEL_STYLE ,
69
- ...( FNDashboard
70
- ? {
71
- color : mode === 'light' ? '#2D333E' : '#DBD9D7' ,
72
- backgroundColor : mode === 'light' ? '#E0E0E0' : '#56524D' ,
73
- }
74
- : { } ) ,
77
+ color : mode === 'light' ? '#2D333E' : '#DBD9D7' ,
75
78
} ) ,
76
- [ mode , FNDashboard ]
79
+ [ mode ]
77
80
) ;
78
81
79
82
if ( variable . hide !== VariableHide . dontHide ) {
80
83
return null ;
81
84
}
82
85
const fnLabelOrName = FNDashboard ? labelOrName . replace ( 'druid_adhoc_filters' , 'ad-hoc' ) : labelOrName ;
83
86
84
- const elementId = VARIABLE_PREFIX + variable . id ;
87
+ const elementId = `var- ${ variable . id } ` ;
85
88
if ( variable . description ) {
86
89
return (
87
90
< Tooltip content = { variable . description } placement = { 'bottom' } >
0 commit comments