Filter theme keys.

This commit is contained in:
Paul 2021-07-01 19:46:50 +01:00
parent 209653dfd7
commit 82b8a9b28e

View file

@ -101,10 +101,12 @@ export const PRESETS: { [key: string]: Theme } = {
}, },
}; };
const keys = Object.keys(PRESETS.dark);
const GlobalTheme = createGlobalStyle<{ theme: Theme }>` const GlobalTheme = createGlobalStyle<{ theme: Theme }>`
:root { :root {
${(props) => ${(props) =>
(Object.keys(props.theme) as Variables[]).map((key) => { (Object.keys(props.theme) as Variables[]).map((key) => {
if (!keys.includes(key)) return;
return `--${key}: ${props.theme[key]};`; return `--${key}: ${props.theme[key]};`;
})} })}
} }