Skip to content

Commit 324a3f0

Browse files
committed
Apply MUI spacing
1 parent 67a0015 commit 324a3f0

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/mui.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { getColorDecisions } from "./lib/generatedFromCss/getColorDecisions";
99
import { getColorOptions } from "./lib/generatedFromCss/getColorOptions";
1010
import { useIsDark } from "./lib/darkMode";
1111
import { typography } from "./lib/generatedFromCss/typography";
12+
import { spacingTokenByValue } from "./lib/generatedFromCss/spacing";
1213

1314
function 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;

0 commit comments

Comments
 (0)