File tree Expand file tree Collapse file tree 4 files changed +45
-8
lines changed Expand file tree Collapse file tree 4 files changed +45
-8
lines changed Original file line number Diff line number Diff line change @@ -34,17 +34,36 @@ const parameters = {
34
34
35
35
const globalTypes = {
36
36
accent : {
37
- name : 'Accent' ,
37
+ name : 'Accent color ' ,
38
38
description : 'Theme accent color for components' ,
39
39
defaultValue : '#006CBE' ,
40
40
toolbar : {
41
+ title : 'Accent color' ,
41
42
icon : 'paintbrush' ,
42
43
// Array of plain string values or MenuItem shape (see below)
43
44
items : [
44
45
{ value : '#006CBE' , right : '🔵' , title : 'blue' } ,
45
46
{ value : '#DA1A5F' , title : 'pink' } ,
46
47
{ value : '#f2c812' , title : 'yellow' }
47
- ]
48
+ ] ,
49
+ dynamicTitle : true
50
+ }
51
+ } ,
52
+ density : {
53
+ name : 'Density' ,
54
+ description : 'UI element density' ,
55
+ defaultValue : 0 ,
56
+ toolbar : {
57
+ title : 'Density' ,
58
+ icon : 'grow' ,
59
+ items : [
60
+ { value : - 4 , title : 'xsmall' } ,
61
+ { value : - 2 , title : 'small' } ,
62
+ { value : 0 , title : 'medium' } ,
63
+ { value : 2 , title : 'large' } ,
64
+ { value : 4 , title : 'xlarge' }
65
+ ] ,
66
+ dynamicTitle : true
48
67
}
49
68
}
50
69
} ;
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
17
17
accentFillRest ,
18
18
bodyFont ,
19
19
controlCornerRadius ,
20
+ density ,
20
21
designUnit ,
21
22
disabledOpacity ,
22
23
focusStrokeWidth ,
@@ -30,7 +31,8 @@ import {
30
31
neutralForegroundRest ,
31
32
strokeWidth ,
32
33
typeRampBaseFontSize ,
33
- typeRampBaseLineHeight
34
+ typeRampBaseLineHeight ,
35
+ typeRampPlus1FontSize
34
36
} from '../design-tokens.js' ;
35
37
import {
36
38
DirectionalStyleSheetBehavior ,
@@ -148,8 +150,8 @@ export const menuItemStyles: FoundationElementTemplate<
148
150
149
151
.expand-collapse-glyph {
150
152
/* TODO: adaptive typography https://github.com/microsoft/fast/issues/2432 */
151
- width : 16 px ;
152
- height : 16 px ;
153
+ width : calc (( 16 + ${ density } ) * 1 px ) ;
154
+ height : calc (( 16 + ${ density } ) * 1 px ) ;
153
155
fill : currentcolor;
154
156
}
155
157
@@ -170,6 +172,12 @@ export const menuItemStyles: FoundationElementTemplate<
170
172
/* TODO: adaptive typography https://github.com/microsoft/fast/issues/2432 */
171
173
width : 16px ;
172
174
height : 16px ;
175
+
176
+ /* Something like that would do if the typography is adaptive
177
+ font-size: inherit;
178
+ width: ${ typeRampPlus1FontSize } ;
179
+ height: ${ typeRampPlus1FontSize } ;
180
+ */
173
181
}
174
182
175
183
: host (: hover ) .start ,
Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ import {
36
36
neutralForegroundRest ,
37
37
strokeWidth ,
38
38
typeRampBaseFontSize ,
39
- typeRampBaseLineHeight
39
+ typeRampBaseLineHeight ,
40
+ typeRampPlus1FontSize
40
41
} from '../design-tokens.js' ;
41
42
import {
42
43
DirectionalStyleSheetBehavior ,
@@ -211,8 +212,8 @@ export const treeItemStyles: FoundationElementTemplate<
211
212
212
213
.expand-collapse-glyph {
213
214
/* TODO: adaptive typography https://github.com/microsoft/fast/issues/2432 */
214
- width : 16 px ;
215
- height : 16 px ;
215
+ width : calc (( 16 + ${ density } ) * 1 px ) ;
216
+ height : calc (( 16 + ${ density } ) * 1 px ) ;
216
217
transition : transform 0.1s linear;
217
218
218
219
pointer-events : none;
@@ -229,6 +230,12 @@ export const treeItemStyles: FoundationElementTemplate<
229
230
/* TODO: adaptive typography https://github.com/microsoft/fast/issues/2432 */
230
231
width : 16px ;
231
232
height : 16px ;
233
+
234
+ /* Something like that would do if the typography is adaptive
235
+ font-size: inherit;
236
+ width: ${ typeRampPlus1FontSize } ;
237
+ height: ${ typeRampPlus1FontSize } ;
238
+ */
232
239
}
233
240
234
241
.start {
Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ export function withTheme(story: any, context: StoryContext): HTMLElement {
55
55
? StandardLuminance . DarkMode
56
56
: StandardLuminance . LightMode ;
57
57
58
+ const density = context . globals . density ;
59
+ theme . density = density ;
60
+
58
61
const children = story ( ) ;
59
62
if ( typeof children === 'string' ) {
60
63
theme . insertAdjacentHTML ( 'afterbegin' , children ) ;
You can’t perform that action at this time.
0 commit comments