Преглед изворни кода

Bugfix: Switcher problems fixed.

lfabl пре 2 недеља
родитељ
комит
cc3765472b

+ 5 - 3
src/components/localeSwitcher/index.tsx

@@ -51,14 +51,16 @@ const LocaleSwitcher: FC<ILocaleSwitcherProps> = ({
         activeLocale
     ]);
 
-    const variantsPre: LocaleSwitchVariants = variantsProps;
+    const variantsPre: Array<Omit<LocaleSwitchVariants[0], "backgroundColor"> & {
+        backgroundColor?: LocaleSwitchVariants[0]["backgroundColor"]
+    }> = variantsProps;
 
     const isHaveNCTRTR = variantsProps.findIndex(iV => iV.localeKey === "tr-TR") !== -1;
     const isHaveNCENUS = variantsProps.findIndex(iV => iV.localeKey === "en-US") !== -1;
 
     if(!isHaveNCTRTR) {
         variantsPre.unshift({
-            backgroundColor: isWorkWithHighlightButton ? "transparent" : "subtle",
+            backgroundColor: isWorkWithHighlightButton ? undefined : "subtle",
             borderColor: "transparent",
             iconColor: "turkish",
             localeKey: "tr-TR",
@@ -74,7 +76,7 @@ const LocaleSwitcher: FC<ILocaleSwitcherProps> = ({
 
     if(!isHaveNCENUS) {
         variantsPre.unshift({
-            backgroundColor: isWorkWithHighlightButton ? "transparent" : "subtle",
+            backgroundColor: isWorkWithHighlightButton ? undefined : "subtle",
             borderColor: "transparent",
             iconColor: "english",
             localeKey: "en-US",

+ 6 - 4
src/components/paletteSwitcher/index.tsx

@@ -52,7 +52,9 @@ const PaletteSwitcher: FC<IPaletteSwitcherProps> = ({
         activePalette
     ]);
 
-    const variantsPre: ThemeSwitchVariants = variantsProps;
+    const variantsPre: Array<Omit<ThemeSwitchVariants[0], "backgroundColor"> & {
+        backgroundColor?: ThemeSwitchVariants[0]["backgroundColor"]
+    }> = variantsProps;
 
     const isHaveNC = variantsProps.findIndex(iV => iV.paletteKey === "nibgat-community") !== -1;
     const isHaveCC = variantsProps.findIndex(iV => iV.paletteKey === "caycore") !== -1;
@@ -60,7 +62,7 @@ const PaletteSwitcher: FC<IPaletteSwitcherProps> = ({
 
     if(!isHaveN) {
         variantsPre.unshift({
-            backgroundColor: isWorkWithHighlightButton ? "transparent" : "subtle",
+            backgroundColor: isWorkWithHighlightButton ? undefined : "subtle",
             borderColor: "transparent",
             paletteKey: "nibgat",
             iconColor: "moon",
@@ -76,7 +78,7 @@ const PaletteSwitcher: FC<IPaletteSwitcherProps> = ({
 
     if(!isHaveNC) {
         variantsPre.unshift({
-            backgroundColor: isWorkWithHighlightButton ? "transparent" : "subtle",
+            backgroundColor: isWorkWithHighlightButton ? undefined : "subtle",
             paletteKey: "nibgat-community",
             borderColor: "transparent",
             iconColor: "moon",
@@ -92,7 +94,7 @@ const PaletteSwitcher: FC<IPaletteSwitcherProps> = ({
 
     if(!isHaveCC) {
         variantsPre.unshift({
-            backgroundColor: isWorkWithHighlightButton ? "transparent" : "subtle",
+            backgroundColor: isWorkWithHighlightButton ? undefined : "subtle",
             borderColor: "transparent",
             paletteKey: "caycore",
             iconColor: "moon",

+ 5 - 3
src/components/themeSwitcher/index.tsx

@@ -52,14 +52,16 @@ const ThemeSwitcher: FC<IThemeSwitcherProps> = ({
         activeTheme
     ]);
 
-    const variantsPre: ThemeSwitchVariants = variantsProps;
+    const variantsPre: Array<Omit<ThemeSwitchVariants[0], "backgroundColor"> & {
+        backgroundColor?: ThemeSwitchVariants[0]["backgroundColor"]
+    }> = variantsProps;
 
     const isHaveLight = variantsProps.findIndex(iV => iV.themeKey === "light") !== -1;
     const isHaveDark = variantsProps.findIndex(iV => iV.themeKey === "dark") !== -1;
 
     if(!isHaveDark) {
         variantsPre.unshift({
-            backgroundColor: isWorkWithHighlightButton ? "transparent" : "subtle",
+            backgroundColor: isWorkWithHighlightButton ? undefined : "subtle",
             borderColor: "transparent",
             iconColor: "moon",
             themeKey: "dark",
@@ -80,7 +82,7 @@ const ThemeSwitcher: FC<IThemeSwitcherProps> = ({
 
     if(!isHaveLight) {
         variantsPre.unshift({
-            backgroundColor: isWorkWithHighlightButton ? "transparent" : "subtle",
+            backgroundColor: isWorkWithHighlightButton ? undefined : "subtle",
             borderColor: "transparent",
             themeKey: "light",
             iconColor: "sun",