Filter theme keys.

pull/1049/head
Paul 2021-07-01 19:46:50 +01:00
parent 4afdd15813
commit 156aee4aba
1 changed files with 2 additions and 0 deletions

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]};`;
})}
}