Skip to content

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

Fix input styles

Krzysztof Bialoglowiczf2783bc20c0f
diff --git a/saleor/static/dashboard-next/components/Checkbox/Checkbox.tsx b/saleor/static/dashboard-next/components/Checkbox/Checkbox.tsx
index 2a715c8e13..658e9803e4 100644
--- a/saleor/static/dashboard-next/components/Checkbox/Checkbox.tsx
+++ b/saleor/static/dashboard-next/components/Checkbox/Checkbox.tsx
@@ -56,7 +56,6 @@ const styles = (theme: Theme) =>
},
WebkitAppearance: "none",
border: `1px solid ${theme.palette.grey[500]}`,
- borderRadius: 4,
boxSizing: "border-box",
cursor: "pointer",
height: 14,
diff --git a/saleor/static/dashboard-next/components/RichTextEditor/RichTextEditor.tsx b/saleor/static/dashboard-next/components/RichTextEditor/RichTextEditor.tsx
index 9610b74948..7095c16983 100644
--- a/saleor/static/dashboard-next/components/RichTextEditor/RichTextEditor.tsx
+++ b/saleor/static/dashboard-next/components/RichTextEditor/RichTextEditor.tsx
@@ -47,22 +47,6 @@ export interface RichTextEditorProps {
const styles = (theme: Theme) =>
createStyles({
- "@keyframes focus": {
- from: {
- transform: "scaleX(0) scaleY(1)"
- },
- to: {
- transform: "scaleX(1) scaleY(1)"
- }
- },
- "@keyframes hover": {
- from: {
- transform: "scaleX(1) scaleY(0)"
- },
- to: {
- transform: "scaleX(1) scaleY(1)"
- }
- },
error: {
color: theme.palette.error.main
},
@@ -70,21 +54,13 @@ const styles = (theme: Theme) =>
marginTop: theme.spacing.unit * 0.75
},
input: {
- "&:hover": {
- borderBottomColor: theme.palette.primary.main
- },
- backgroundColor: theme.overrides.MuiFilledInput.root.backgroundColor,
- borderBottom: `1px rgba(0, 0, 0, 0) solid`,
- borderTopLeftRadius: 4,
- borderTopRightRadius: 4,
- padding: "27px 12px 10px",
- position: "relative",
- transition: theme.transitions.duration.shortest + "ms"
+ position: "relative"
},
label: {
fontSize: theme.typography.caption.fontSize,
- marginBottom: theme.spacing.unit * 2,
- marginTop: -21
+ left: 12,
+ position: "absolute",
+ top: 9
},
linkIcon: {
marginTop: 2
@@ -99,8 +75,6 @@ const styles = (theme: Theme) =>
color: theme.palette.primary.light
},
"&:after": {
- animationDuration: theme.transitions.duration.shortest + "ms",
- animationFillMode: "both",
background: theme.palette.getContrastText(
theme.palette.background.default
),
@@ -122,16 +96,18 @@ const styles = (theme: Theme) =>
"& .Draftail": {
"&-Editor": {
"&--focus": {
- "& .DraftEditor": {
- "&-editorContainer": {
- "&:after": {
- animationName: "focus !important",
- background: theme.palette.primary.main,
- transform: "scaleX(0) scaleY(1)"
- }
- }
- }
- }
+ borderColor: theme.palette.common.white,
+ boxShadow: `inset 0px 0px 0px 2px ${theme.palette.primary.main}`
+ },
+ "&:hover": {
+ borderColor: theme.palette.primary.main
+ },
+ border: `1px rgba(0, 0, 0, 0.23) solid`,
+ borderTopLeftRadius: 4,
+ borderTopRightRadius: 4,
+ padding: "27px 12px 10px",
+ position: "relative",
+ transition: theme.transitions.duration.shortest + "ms"
},
"&-Toolbar": {
"&Button": {
@@ -192,6 +168,7 @@ const styles = (theme: Theme) =>
display: "inline-flex",
flexWrap: "wrap",
marginBottom: theme.spacing.unit,
+ marginTop: 10,
[theme.breakpoints.down(460)]: {
width: "min-content"
}
@@ -207,24 +184,7 @@ const styles = (theme: Theme) =>
"&$error": {
"& .Draftail": {
"&-Editor": {
- "& .DraftEditor": {
- "&-editorContainer": {
- "&:after": {
- animationName: "none",
- background: theme.palette.error.main,
- transform: "scaleX(1) scaleY(1)"
- }
- }
- },
- "&--focus": {
- "& .DraftEditor": {
- "&-editorContainer": {
- "&:after": {
- animationName: "none !important"
- }
- }
- }
- }
+ borderColor: theme.palette.error.main
}
}
}
diff --git a/saleor/static/dashboard-next/components/Theme/ThemeProvider.tsx b/saleor/static/dashboard-next/components/Theme/ThemeProvider.tsx
index 2e04cceb97..5bb0703636 100644
--- a/saleor/static/dashboard-next/components/Theme/ThemeProvider.tsx
+++ b/saleor/static/dashboard-next/components/Theme/ThemeProvider.tsx
@@ -25,8 +25,10 @@ const dark: IThemeColors = {
},
input: {
default: "#25262A",
- disabled: "#292A2D",
- focused: "#25262A"
+ disabled: "none",
+ focused: "#25262A",
+ text: "#9E9D9D",
+ textHover: "#616161"
},
paperBorder: "#252728",
primary: "#13BEBB",
@@ -50,9 +52,11 @@ const light: IThemeColors = {
disabled: "rgba(216, 216, 216, 0.3)"
},
input: {
- default: "#F1F6F6",
+ default: "#FFFFFF",
disabled: "#EAEAEA",
- focused: "#DCEBEB"
+ focused: "#FFFFFF",
+ text: "#9D9D9D",
+ textHover: "#616161"
},
paperBorder: "#EAEAEA",
primary: "#06847B",
diff --git a/saleor/static/dashboard-next/theme.ts b/saleor/static/dashboard-next/theme.ts
index dff2e1daad..9b40023c5f 100644
--- a/saleor/static/dashboard-next/theme.ts
+++ b/saleor/static/dashboard-next/theme.ts
@@ -21,7 +21,10 @@ export type IThemeColors = Record<
} & {
gray: Record<"default" | "disabled", string>;
} & {
- input: Record<"default" | "focused" | "disabled", string>;
+ input: Record<
+ "default" | "focused" | "disabled" | "text" | "textHover",
+ string
+ >;
};
const fontFamily = '"Inter", "roboto", "sans-serif"';
@@ -68,41 +71,6 @@ export default (colors: IThemeColors): Theme =>
flexDirection: "row-reverse" as "row-reverse"
}
},
- MuiFilledInput: {
- root: {
- "&$disabled": {
- backgroundColor: colors.input.disabled
- },
- "&$focused": {
- backgroundColor: colors.input.focused
- },
- "&:hover": {
- backgroundColor: colors.input.default
- },
- backgroundColor: colors.input.default
- },
- underline: {
- "&$focused": {
- "&:after": {
- borderBottomColor: colors.primary
- }
- },
- "&:before": {
- borderBottomColor: "rgba(0, 0, 0, 0)"
- },
- "&:hover": {
- "&:not($disabled)": {
- "&:not($focused)": {
- "&:not($error)": {
- "&:before": {
- borderBottomColor: colors.primary
- }
- }
- }
- }
- }
- }
- },
MuiIconButton: {
root: {
"&:hover": {
@@ -134,19 +102,20 @@ export default (colors: IThemeColors): Theme =>
}
},
MuiInputLabel: {
- filled: {
- transform: "translate(12px, 10px) scale(0.75)"
- },
formControl: {
transform: "translate(0, 1.5px) scale(0.75)",
transformOrigin: "top left" as "top left",
width: "100%"
},
+ outlined: {
+ "&$shrink": {
+ transform: "translate(12px, 6px) scale(0.75)"
+ }
+ },
root: {
- color: [[colors.primary], "!important"] as any
+ color: [[colors.input.text], "!important"] as any
},
shrink: {
- // Negates x0.75 scale
width: "133%"
}
},
@@ -185,7 +154,42 @@ export default (colors: IThemeColors): Theme =>
borderRadius: 4
}
},
-
+ MuiOutlinedInput: {
+ input: {
+ color: colors.input.text,
+ margin: "4px 0",
+ padding: "25px 12px 8px 12px"
+ },
+ root: {
+ "& legend": {
+ display: "none"
+ },
+ "&$disabled": {
+ "& fieldset": {
+ backgroundColor: colors.input.disabled
+ },
+ "& input": {
+ color: colors.input.text,
+ zIndex: 2
+ }
+ },
+ "&$focused": {
+ "& input": {
+ color: colors.input.textHover,
+ zIndex: 2
+ }
+ },
+ "&:hover": {
+ "& fieldset": {
+ borderColor: colors.primary + "!important"
+ },
+ "& input": {
+ color: colors.input.textHover,
+ zIndex: 2
+ }
+ }
+ }
+ },
MuiSwitch: {
bar: {
"$colorPrimary$checked + &": {
@@ -362,5 +366,5 @@ export default (colors: IThemeColors): Theme =>
TextField.defaultProps = {
...TextField.defaultProps,
- variant: "filled"
+ variant: "outlined"
};