Fix default theme fallback when an invalid theme is passed (#15)
* fix(color): invalid theme fallback to default Fixes: #4641 * test(color): add test case for invalid theme fallback to default * style(color): add back the tab space * test(color): fix color default theme * fix(color): use 'in' instead of '.hasOwnProperty' * fix new test * format code --------- Co-authored-by: mikyll <righi.michy@gmail.com>
This commit is contained in:
+2
-1
@@ -83,7 +83,8 @@ const getCardColors = ({
|
||||
theme,
|
||||
}) => {
|
||||
const defaultTheme = themes["default"];
|
||||
const isThemeProvided = theme !== null && theme !== undefined;
|
||||
const isThemeProvided =
|
||||
theme !== null && theme !== undefined && theme in themes;
|
||||
|
||||
// @ts-ignore
|
||||
const selectedTheme = isThemeProvided ? themes[theme] : defaultTheme;
|
||||
|
||||
Reference in New Issue
Block a user