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";
9
9
import { getColorOptions } from "./lib/generatedFromCss/getColorOptions" ;
10
10
import { useIsDark } from "./lib/darkMode" ;
11
11
import { typography } from "./lib/generatedFromCss/typography" ;
12
+ import { spacingTokenByValue } from "./lib/generatedFromCss/spacing" ;
12
13
13
14
function createMuiDsfrTheme ( params : { isDark : boolean } ) : MuiTheme {
14
15
const { isDark } = params ;
@@ -62,7 +63,21 @@ function createMuiDsfrTheme(params: { isDark: boolean }): MuiTheme {
62
63
//"caption": {},
63
64
//"button": {},
64
65
//"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
+ } ) ( )
66
81
} ) ;
67
82
68
83
return muiTheme ;
You can’t perform that action at this time.
0 commit comments