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 = {
3434
3535const globalTypes = {
3636 accent : {
37- name : 'Accent' ,
37+ name : 'Accent color ' ,
3838 description : 'Theme accent color for components' ,
3939 defaultValue : '#006CBE' ,
4040 toolbar : {
41+ title : 'Accent color' ,
4142 icon : 'paintbrush' ,
4243 // Array of plain string values or MenuItem shape (see below)
4344 items : [
4445 { value : '#006CBE' , right : '🔵' , title : 'blue' } ,
4546 { value : '#DA1A5F' , title : 'pink' } ,
4647 { 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
4867 }
4968 }
5069} ;
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
1717 accentFillRest ,
1818 bodyFont ,
1919 controlCornerRadius ,
20+ density ,
2021 designUnit ,
2122 disabledOpacity ,
2223 focusStrokeWidth ,
@@ -30,7 +31,8 @@ import {
3031 neutralForegroundRest ,
3132 strokeWidth ,
3233 typeRampBaseFontSize ,
33- typeRampBaseLineHeight
34+ typeRampBaseLineHeight ,
35+ typeRampPlus1FontSize
3436} from '../design-tokens.js' ;
3537import {
3638 DirectionalStyleSheetBehavior ,
@@ -148,8 +150,8 @@ export const menuItemStyles: FoundationElementTemplate<
148150
149151 .expand-collapse-glyph {
150152 /* 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 ) ;
153155 fill : currentcolor;
154156 }
155157
@@ -170,6 +172,12 @@ export const menuItemStyles: FoundationElementTemplate<
170172 /* TODO: adaptive typography https://github.com/microsoft/fast/issues/2432 */
171173 width : 16px ;
172174 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+ */
173181 }
174182
175183 : host (: hover ) .start ,
Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ import {
3636 neutralForegroundRest ,
3737 strokeWidth ,
3838 typeRampBaseFontSize ,
39- typeRampBaseLineHeight
39+ typeRampBaseLineHeight ,
40+ typeRampPlus1FontSize
4041} from '../design-tokens.js' ;
4142import {
4243 DirectionalStyleSheetBehavior ,
@@ -211,8 +212,8 @@ export const treeItemStyles: FoundationElementTemplate<
211212
212213 .expand-collapse-glyph {
213214 /* 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 ) ;
216217 transition : transform 0.1s linear;
217218
218219 pointer-events : none;
@@ -229,6 +230,12 @@ export const treeItemStyles: FoundationElementTemplate<
229230 /* TODO: adaptive typography https://github.com/microsoft/fast/issues/2432 */
230231 width : 16px ;
231232 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+ */
232239 }
233240
234241 .start {
Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ export function withTheme(story: any, context: StoryContext): HTMLElement {
5555 ? StandardLuminance . DarkMode
5656 : StandardLuminance . LightMode ;
5757
58+ const density = context . globals . density ;
59+ theme . density = density ;
60+
5861 const children = story ( ) ;
5962 if ( typeof children === 'string' ) {
6063 theme . insertAdjacentHTML ( 'afterbegin' , children ) ;
You can’t perform that action at this time.
0 commit comments