@@ -2,17 +2,17 @@ import { css, CSSObject } from '@emotion/react';
2
2
3
3
import { GrafanaTheme2 , ThemeTypographyVariant } from '@grafana/data' ;
4
4
5
- // import { getFocusStyles } from '../mixins';
5
+ import { getFocusStyles } from '../mixins' ;
6
6
7
7
export function getElementStyles ( theme : GrafanaTheme2 ) {
8
8
return css ( {
9
9
html : {
10
10
MsOverflowStyle : 'scrollbar' ,
11
11
WebkitTapHighlightColor : 'rgba(0, 0, 0, 0)' ,
12
12
height : '100%' ,
13
- // fontFamily: theme.typography.fontFamily,
14
- // lineHeight: theme.typography.body.lineHeight,
15
- // fontKerning: 'normal',
13
+ fontFamily : theme . typography . fontFamily ,
14
+ lineHeight : theme . typography . body . lineHeight ,
15
+ fontKerning : 'normal' ,
16
16
} ,
17
17
18
18
':root' : {
@@ -28,129 +28,129 @@ export function getElementStyles(theme: GrafanaTheme2) {
28
28
...getVariantStyles ( theme . typography . body ) ,
29
29
} ,
30
30
31
- // 'h1, .h1': getVariantStyles(theme.typography.h1),
32
- // 'h2, .h2': getVariantStyles(theme.typography.h2),
33
- // 'h3, .h3': getVariantStyles(theme.typography.h3),
34
- // 'h4, .h4': getVariantStyles(theme.typography.h4),
35
- // 'h5, .h5': getVariantStyles(theme.typography.h5),
36
- // 'h6, .h6': getVariantStyles(theme.typography.h6),
37
-
38
- // p: {
39
- // margin: theme.spacing(0, 0, 2),
40
- // },
41
-
42
- // button: {
43
- // letterSpacing: theme.typography.body.letterSpacing,
44
-
45
- // '&:focus-visible': getFocusStyles(theme),
46
- // '&:focus': {
47
- // outline: 'none',
48
- // },
49
- // },
50
-
51
- // // Ex: 14px base font * 85% = about 12px
52
- // small: {
53
- // fontSize: theme.typography.bodySmall.fontSize,
54
- // },
55
-
56
- // 'b, strong': {
57
- // fontWeight: theme.typography.fontWeightMedium,
58
- // },
59
-
60
- // em: {
61
- // fontStyle: 'italic',
62
- // color: theme.colors.text.primary,
63
- // },
64
-
65
- // cite: {
66
- // fontStyle: 'normal',
67
- // },
68
-
69
- // // Utility classes
70
- // '.muted': {
71
- // color: theme.colors.text.secondary,
72
- // },
73
-
74
- // 'a.muted:hover, a.muted:focus': {
75
- // color: theme.colors.text.primary,
76
- // },
77
-
78
- // '.text-warning': {
79
- // color: theme.colors.warning.text,
80
-
81
- // '&:hover, &:focus': {
82
- // color: theme.colors.emphasize(theme.colors.warning.text, 0.15),
83
- // },
84
- // },
85
-
86
- // '.text-error': {
87
- // color: theme.colors.error.text,
88
-
89
- // '&:hover, &:focus': {
90
- // color: theme.colors.emphasize(theme.colors.error.text, 0.15),
91
- // },
92
- // },
93
-
94
- // '.text-success': {
95
- // color: '$success-text-color',
96
-
97
- // '&:hover, &:focus': {
98
- // color: theme.colors.emphasize(theme.colors.success.text, 0.15),
99
- // },
100
- // },
101
-
102
- // a: {
103
- // cursor: 'pointer',
104
- // color: theme.colors.text.primary,
105
- // textDecoration: 'none',
106
-
107
- // '&:focus': {
108
- // outline: 'none',
109
- // },
110
-
111
- // '&:focus-visible': getFocusStyles(theme),
112
-
113
- // '&:[disabled]': {
114
- // cursor: 'default',
115
- // // Need type assertion here due to the use of !important
116
- // // see https://github.com/frenic/csstype/issues/114#issuecomment-697201978
117
- // // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
118
- // pointerEvents: 'none !important' as 'none',
119
- // },
120
- // },
121
-
122
- // '.text-link': {
123
- // textDecoration: 'underline',
124
- // },
125
-
126
- // '.text-left': {
127
- // textAlign: 'left',
128
- // },
129
-
130
- // '.text-right': {
131
- // textAlign: 'right',
132
- // },
133
-
134
- // '.text-center': {
135
- // textAlign: 'center',
136
- // },
137
-
138
- // '.highlight-search-match': {
139
- // background: theme.components.textHighlight.background,
140
- // color: theme.components.textHighlight.text,
141
- // padding: 0,
142
- // },
31
+ 'h1, .h1' : getVariantStyles ( theme . typography . h1 ) ,
32
+ 'h2, .h2' : getVariantStyles ( theme . typography . h2 ) ,
33
+ 'h3, .h3' : getVariantStyles ( theme . typography . h3 ) ,
34
+ 'h4, .h4' : getVariantStyles ( theme . typography . h4 ) ,
35
+ 'h5, .h5' : getVariantStyles ( theme . typography . h5 ) ,
36
+ 'h6, .h6' : getVariantStyles ( theme . typography . h6 ) ,
37
+
38
+ p : {
39
+ margin : theme . spacing ( 0 , 0 , 2 ) ,
40
+ } ,
41
+
42
+ button : {
43
+ letterSpacing : theme . typography . body . letterSpacing ,
44
+
45
+ '&:focus-visible' : getFocusStyles ( theme ) ,
46
+ '&:focus' : {
47
+ outline : 'none' ,
48
+ } ,
49
+ } ,
50
+
51
+ // Ex: 14px base font * 85% = about 12px
52
+ small : {
53
+ fontSize : theme . typography . bodySmall . fontSize ,
54
+ } ,
55
+
56
+ 'b, strong' : {
57
+ fontWeight : theme . typography . fontWeightMedium ,
58
+ } ,
59
+
60
+ em : {
61
+ fontStyle : 'italic' ,
62
+ color : theme . colors . text . primary ,
63
+ } ,
64
+
65
+ cite : {
66
+ fontStyle : 'normal' ,
67
+ } ,
68
+
69
+ // Utility classes
70
+ '.muted' : {
71
+ color : theme . colors . text . secondary ,
72
+ } ,
73
+
74
+ 'a.muted:hover, a.muted:focus' : {
75
+ color : theme . colors . text . primary ,
76
+ } ,
77
+
78
+ '.text-warning' : {
79
+ color : theme . colors . warning . text ,
80
+
81
+ '&:hover, &:focus' : {
82
+ color : theme . colors . emphasize ( theme . colors . warning . text , 0.15 ) ,
83
+ } ,
84
+ } ,
85
+
86
+ '.text-error' : {
87
+ color : theme . colors . error . text ,
88
+
89
+ '&:hover, &:focus' : {
90
+ color : theme . colors . emphasize ( theme . colors . error . text , 0.15 ) ,
91
+ } ,
92
+ } ,
93
+
94
+ '.text-success' : {
95
+ color : '$success-text-color' ,
96
+
97
+ '&:hover, &:focus' : {
98
+ color : theme . colors . emphasize ( theme . colors . success . text , 0.15 ) ,
99
+ } ,
100
+ } ,
101
+
102
+ a : {
103
+ cursor : 'pointer' ,
104
+ color : theme . colors . text . primary ,
105
+ textDecoration : 'none' ,
106
+
107
+ '&:focus' : {
108
+ outline : 'none' ,
109
+ } ,
110
+
111
+ '&:focus-visible' : getFocusStyles ( theme ) ,
112
+
113
+ '&:[disabled]' : {
114
+ cursor : 'default' ,
115
+ // Need type assertion here due to the use of !important
116
+ // see https://github.com/frenic/csstype/issues/114#issuecomment-697201978
117
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
118
+ pointerEvents : 'none !important' as 'none' ,
119
+ } ,
120
+ } ,
121
+
122
+ '.text-link' : {
123
+ textDecoration : 'underline' ,
124
+ } ,
125
+
126
+ '.text-left' : {
127
+ textAlign : 'left' ,
128
+ } ,
129
+
130
+ '.text-right' : {
131
+ textAlign : 'right' ,
132
+ } ,
133
+
134
+ '.text-center' : {
135
+ textAlign : 'center' ,
136
+ } ,
137
+
138
+ '.highlight-search-match' : {
139
+ background : theme . components . textHighlight . background ,
140
+ color : theme . components . textHighlight . text ,
141
+ padding : 0 ,
142
+ } ,
143
143
} ) ;
144
144
}
145
145
146
146
export function getVariantStyles ( variant : ThemeTypographyVariant ) : CSSObject {
147
147
return {
148
148
margin : 0 ,
149
- // fontSize: variant.fontSize,
150
- // lineHeight: variant.lineHeight,
151
- // fontWeight: variant.fontWeight,
152
- // letterSpacing: variant.letterSpacing,
153
- // fontFamily: variant.fontFamily,
149
+ fontSize : variant . fontSize ,
150
+ lineHeight : variant . lineHeight ,
151
+ fontWeight : variant . fontWeight ,
152
+ letterSpacing : variant . letterSpacing ,
153
+ fontFamily : variant . fontFamily ,
154
154
marginBottom : '0.45em' ,
155
155
} ;
156
156
}
0 commit comments