Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix single select field
dominik-zeglen3eae54843ce1
diff --git a/saleor/static/dashboard-next/components/SingleSelectField/SingleSelectField.tsx b/saleor/static/dashboard-next/components/SingleSelectField/SingleSelectField.tsxindex 485cf897a1..a7f8834da4 100644--- a/saleor/static/dashboard-next/components/SingleSelectField/SingleSelectField.tsx+++ b/saleor/static/dashboard-next/components/SingleSelectField/SingleSelectField.tsx@@ -1,6 +1,7 @@import FormControl from "@material-ui/core/FormControl";import FormHelperText from "@material-ui/core/FormHelperText";import InputLabel from "@material-ui/core/InputLabel";+import FilledInput from "@material-ui/core/FilledInput";import MenuItem from "@material-ui/core/MenuItem";import Select, { SelectProps } from "@material-ui/core/Select";import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";@@ -60,13 +61,14 @@ export const SingleSelectField = withStyles(styles, {><InputLabel shrink={!!value}>{label}</InputLabel><Select+ variant="filled"fullWidthrenderValue={choiceValue =>choiceValue ? choicesByKey[choiceValue.toString()] : ""}value={value || ""}- name={name}onChange={onChange}+ input={<FilledInput name={name} />}{...selectProps}>{choices.length > 0 ? (diff --git a/saleor/static/dashboard-next/storybook/CardDecorator.tsx b/saleor/static/dashboard-next/storybook/CardDecorator.tsxnew file mode 100644index 0000000000..e00a374814--- /dev/null+++ b/saleor/static/dashboard-next/storybook/CardDecorator.tsx@@ -0,0 +1,16 @@+import Card from "@material-ui/core/Card";+import CardContent from "@material-ui/core/CardContent";+import * as React from "react";++const CardDecorator = storyFn => (+ <Card+ style={{+ margin: "auto",+ overflow: "visible",+ width: 400+ }}+ >+ <CardContent>{storyFn()}</CardContent>+ </Card>+);+export default CardDecorator;diff --git a/saleor/static/dashboard-next/storybook/stories/components/SingleSelectField.tsx b/saleor/static/dashboard-next/storybook/stories/components/SingleSelectField.tsxindex 84edc09d95..6d7fc0a789 100644--- a/saleor/static/dashboard-next/storybook/stories/components/SingleSelectField.tsx+++ b/saleor/static/dashboard-next/storybook/stories/components/SingleSelectField.tsx@@ -2,6 +2,8 @@ import { storiesOf } from "@storybook/react";import * as React from "react";import SingleSelectField from "../../../components/SingleSelectField";+import CardDecorator from "../../CardDecorator";+import Decorator from "../../Decorator";const choices = [{ value: "1", label: "Apparel" },@@ -11,6 +13,8 @@ const choices = [];storiesOf("Generics / SingleSelectField", module)+ .addDecorator(CardDecorator)+ .addDecorator(Decorator).add("with no value", () => (<SingleSelectField choices={choices} onChange={undefined} />))diff --git a/saleor/static/dashboard-next/theme.ts b/saleor/static/dashboard-next/theme.tsindex 2eb9814e81..03719d4801 100644--- a/saleor/static/dashboard-next/theme.ts+++ b/saleor/static/dashboard-next/theme.ts@@ -92,6 +92,13 @@ export default (colors: IThemeColors): Theme =>}}},+ MuiIconButton: {+ root: {+ "&:hover": {+ backgroundColor: fade(colors.primary, 0.12)+ }+ }+ },MuiInput: {input: {"&:-webkit-autofill": {@@ -132,11 +139,34 @@ export default (colors: IThemeColors): Theme =>width: "133%"}},+ MuiList: {+ root: {+ display: "grid",+ gridRowGap: 8 + "px",+ padding: "8px !important"+ }+ },+ MuiListItem: {+ button: {+ "&:focus": {+ backgroundColor: colors.input.default+ }+ }+ },MuiMenu: {paper: {borderRadius: 8}},+ MuiMenuItem: {+ root: {+ "&:hover, &$selected, &$selected:focus": {+ backgroundColor: colors.input.default+ },+ borderRadius: 4+ }+ },+MuiSwitch: {bar: {"$colorPrimary$checked + &": {@@ -223,6 +253,16 @@ export default (colors: IThemeColors): Theme =>backgroundColor: fade(colors.primary, 0.05)}}+ },+ MuiTouchRipple: {+ childLeaving: {+ backgroundColor: fade(colors.primary, 0.2)+ },+ ripple: {+ "&$rippleVisible": {+ backgroundColor: fade(colors.primary, 0.2)+ }+ }}},palette: {@@ -245,6 +285,11 @@ export default (colors: IThemeColors): Theme =>secondary: colors.font.gray}},+ props: {+ MuiFormControl: {+ variant: "filled"+ }+ },shadows: ["none",createShadow(1, 1, 0, 2, 1, -2, 1, 3, 0),