diff --git a/src/components/CardTitle/CardTitle.tsx b/src/components/CardTitle/CardTitle.tsx index eb565e834..ec72d2f55 100644 --- a/src/components/CardTitle/CardTitle.tsx +++ b/src/components/CardTitle/CardTitle.tsx @@ -23,6 +23,7 @@ const useStyles = makeStyles(theme => ({ }), title: { flex: 1, + fontWeight: 500, lineHeight: 1 }, toolbar: { diff --git a/src/components/ControlledCheckbox.tsx b/src/components/ControlledCheckbox.tsx index 7ed45d330..4a79d9085 100644 --- a/src/components/ControlledCheckbox.tsx +++ b/src/components/ControlledCheckbox.tsx @@ -4,6 +4,7 @@ import React from "react"; import Checkbox from "./Checkbox"; interface ControlledCheckboxProps { + className?: string; name: string; label?: React.ReactNode; checked: boolean; @@ -16,7 +17,8 @@ export const ControlledCheckbox: React.FC = ({ disabled, name, label, - onChange + onChange, + ...props }) => ( = ({ /> } label={label} + {...props} /> ); ControlledCheckbox.displayName = "ControlledCheckbox"; diff --git a/src/customers/components/CustomerDetails/CustomerDetails.tsx b/src/customers/components/CustomerDetails/CustomerDetails.tsx index 5496ed387..1db8cf109 100644 --- a/src/customers/components/CustomerDetails/CustomerDetails.tsx +++ b/src/customers/components/CustomerDetails/CustomerDetails.tsx @@ -9,39 +9,34 @@ import { FormattedMessage, useIntl } from "react-intl"; import CardTitle from "@saleor/components/CardTitle"; import { ControlledCheckbox } from "@saleor/components/ControlledCheckbox"; -import { FormSpacer } from "@saleor/components/FormSpacer"; import Skeleton from "@saleor/components/Skeleton"; -import { commonMessages } from "@saleor/intl"; +import { maybe } from "@saleor/misc"; +import { FormErrors } from "@saleor/types"; import { CustomerDetails_user } from "../../types/CustomerDetails"; const useStyles = makeStyles(theme => ({ cardTitle: { - height: 64 + height: 72 }, - root: { - display: "grid" as "grid", - gridColumnGap: theme.spacing(2), - gridRowGap: theme.spacing(3), - gridTemplateColumns: "1fr 1fr" + checkbox: { + marginBottom: theme.spacing() + }, + content: { + paddingTop: theme.spacing() + }, + subtitle: { + marginTop: theme.spacing() } })); export interface CustomerDetailsProps { customer: CustomerDetails_user; data: { - firstName: string; - lastName: string; - email: string; isActive: boolean; note: string; }; disabled: boolean; - errors: { - firstName?: string; - lastName?: string; - email?: string; - note?: string; - }; + errors: FormErrors<"isActive" | "note">; onChange: (event: React.ChangeEvent) => void; } @@ -57,11 +52,15 @@ const CustomerDetails: React.FC = props => { className={classes.cardTitle} title={ <> - + {maybe(() => customer.email, )} {customer && customer.dateJoined ? ( - + = props => { } /> - + = props => { name="isActive" onChange={onChange} /> - -
- - -
- - - = ({ onChange={change} /> + + customer.orders.edges.map(edge => edge.node) diff --git a/src/customers/components/CustomerInfo/CustomerInfo.tsx b/src/customers/components/CustomerInfo/CustomerInfo.tsx new file mode 100644 index 000000000..ca158a994 --- /dev/null +++ b/src/customers/components/CustomerInfo/CustomerInfo.tsx @@ -0,0 +1,128 @@ +import Card from "@material-ui/core/Card"; +import CardContent from "@material-ui/core/CardContent"; +import { makeStyles } from "@material-ui/core/styles"; +import TextField from "@material-ui/core/TextField"; +import Typography from "@material-ui/core/Typography"; +import moment from "moment-timezone"; +import React from "react"; +import { FormattedMessage, useIntl } from "react-intl"; + +import CardTitle from "@saleor/components/CardTitle"; +import Grid from "@saleor/components/Grid"; +import Hr from "@saleor/components/Hr"; +import Skeleton from "@saleor/components/Skeleton"; +import { commonMessages } from "@saleor/intl"; +import { CustomerDetails_user } from "../../types/CustomerDetails"; + +const useStyles = makeStyles(theme => ({ + cardTitle: { + height: 64 + }, + content: { + paddingTop: theme.spacing(2) + }, + hr: { + margin: theme.spacing(3, 0) + }, + sectionHeader: { + marginBottom: theme.spacing() + } +})); + +export interface CustomerDetailsProps { + customer: CustomerDetails_user; + data: { + firstName: string; + lastName: string; + email: string; + }; + disabled: boolean; + errors: { + firstName?: string; + lastName?: string; + email?: string; + }; + onChange: (event: React.ChangeEvent) => void; +} + +const CustomerDetails: React.FC = props => { + const { customer, data, disabled, errors, onChange } = props; + const classes = useStyles(props); + + const intl = useIntl(); + + return ( + + + + {customer && customer.dateJoined ? ( + + + + ) : ( + + )} + + } + /> + + + + + + + + +
+ + + + +
+
+ ); +}; +CustomerDetails.displayName = "CustomerDetails"; +export default CustomerDetails; diff --git a/src/customers/components/CustomerInfo/index.ts b/src/customers/components/CustomerInfo/index.ts new file mode 100644 index 000000000..5add7b0f4 --- /dev/null +++ b/src/customers/components/CustomerInfo/index.ts @@ -0,0 +1,2 @@ +export { default } from "./CustomerInfo"; +export * from "./CustomerInfo"; diff --git a/src/theme.ts b/src/theme.ts index 3b41cc746..52a60e9c1 100644 --- a/src/theme.ts +++ b/src/theme.ts @@ -397,12 +397,12 @@ export default (colors: IThemeColors): Theme => }, MuiTableCell: { body: { - fontSize: ".875rem", + fontSize: "1rem", paddingBottom: 8, paddingTop: 8 }, head: { - fontSize: ".875rem" + fontSize: "1rem" }, paddingCheckbox: { "&:first-child": {