Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix switch styles

dominik-zeglenc7bbda2dae7d
diff --git a/saleor/static/dashboard-next/components/AppLayout/ThemeSwitch.tsx b/saleor/static/dashboard-next/components/AppLayout/ThemeSwitch.tsx
index 6c8f125038..4292f1c732 100644
--- a/saleor/static/dashboard-next/components/AppLayout/ThemeSwitch.tsx
+++ b/saleor/static/dashboard-next/components/AppLayout/ThemeSwitch.tsx
@@ -1,14 +1,11 @@
-import { Theme, withStyles, WithStyles } from "@material-ui/core/styles";
-import { CSSProperties } from "@material-ui/core/styles/withStyles";
-import Switch, { SwitchClassKey, SwitchProps } from "@material-ui/core/Switch";
+import { Theme, withStyles } from "@material-ui/core/styles";
+import Switch, { SwitchProps } from "@material-ui/core/Switch";
import * as React from "react";
import MoonIcon from "../../icons/Moon";
import SunIcon from "../../icons/Sun";
-const switchStyles: (
- theme: Theme
-) => Record<SwitchClassKey, CSSProperties> = theme => ({
+const switchStyles = (theme: Theme) => ({
bar: {
"$colorPrimary$checked + &": {
backgroundColor: theme.palette.background.paper
@@ -22,11 +19,6 @@ const switchStyles: (
}
},
colorPrimary: {},
- colorSecondary: {},
- disabled: {},
- icon: {},
- iconChecked: {},
- input: {},
root: {
"& svg": {
background: theme.palette.primary.main,
@@ -35,12 +27,11 @@ const switchStyles: (
width: 20
},
width: 58
- },
- switchBase: {}
+ }
});
const ThemeSwitch = withStyles(switchStyles, {
name: "ThemeSwitch"
-})((props: SwitchProps & WithStyles<typeof switchStyles>) => (
+})((props: SwitchProps) => (
<Switch
{...props}
color="primary"
diff --git a/saleor/static/dashboard-next/theme.ts b/saleor/static/dashboard-next/theme.ts
index ed42b27e46..6930c2ce60 100644
--- a/saleor/static/dashboard-next/theme.ts
+++ b/saleor/static/dashboard-next/theme.ts
@@ -108,16 +108,6 @@ export default (colors: IThemeColors): Theme =>
opacity: [["1"], "!important"] as any,
width: 48
},
- checked: {
- transform: "translateX(24px)"
- },
- disabled: {
- "&$switchBase": {
- "& + $bar": {
- backgroundColor: colors.gray.disabled
- }
- }
- },
icon: {
backgroundColor: colors.background.paper,
boxShadow: "none",
@@ -126,6 +116,18 @@ export default (colors: IThemeColors): Theme =>
iconChecked: {
backgroundColor: colors.background.paper,
boxShadow: "none"
+ },
+ root: {
+ "& $checked": {
+ transform: "translateX(24px)"
+ },
+ "&$disabled": {
+ "&$switchBase": {
+ "& + $bar": {
+ backgroundColor: colors.gray.disabled
+ }
+ }
+ }
}
},
MuiTable: {