Filter theme keys.

This commit is contained in:
Paul
2021-07-01 21:24:20 +01:00
parent 209653dfd7
commit 82b8a9b28e
+2
View File
@@ -101,10 +101,12 @@ export const PRESETS: { [key: string]: Theme } = {
},
};
const keys = Object.keys(PRESETS.dark);
const GlobalTheme = createGlobalStyle<{ theme: Theme }>`
:root {
${(props) =>
(Object.keys(props.theme) as Variables[]).map((key) => {
if (!keys.includes(key)) return;
return `--${key}: ${props.theme[key]};`;
})}
}