File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import { getColorDecisions } from "./lib/generatedFromCss/getColorDecisions";
99import { getColorOptions } from "./lib/generatedFromCss/getColorOptions" ;
1010import { useIsDark } from "./lib/darkMode" ;
1111import { typography } from "./lib/generatedFromCss/typography" ;
12+ import { spacingTokenByValue } from "./lib/generatedFromCss/spacing" ;
1213
1314function createMuiDsfrTheme ( params : { isDark : boolean } ) : MuiTheme {
1415 const { isDark } = params ;
@@ -62,7 +63,21 @@ function createMuiDsfrTheme(params: { isDark: boolean }): MuiTheme {
6263 //"caption": {},
6364 //"button": {},
6465 //"overline": {}
65- }
66+ } ,
67+ "spacing" : ( ( ) => {
68+ //NOTE: The properties are declared sorted in the object.
69+ const values = Object . values ( spacingTokenByValue ) ;
70+
71+ return ( abs : string | number ) =>
72+ typeof abs === "string"
73+ ? abs
74+ : abs === 0
75+ ? 0
76+ : ( ( ) => {
77+ const value = values [ abs - 1 ] ;
78+ return value === undefined ? abs : value ;
79+ } ) ( ) ;
80+ } ) ( )
6681 } ) ;
6782
6883 return muiTheme ;
You can’t perform that action at this time.
0 commit comments