Skip to content

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

Use inverted grid

dominik-zeglene093c34488d6
diff --git a/saleor/static/dashboard-next/components/Grid/Grid.tsx b/saleor/static/dashboard-next/components/Grid/Grid.tsx
index 85d48e0aa4..69a211aa9e 100644
--- a/saleor/static/dashboard-next/components/Grid/Grid.tsx
+++ b/saleor/static/dashboard-next/components/Grid/Grid.tsx
@@ -7,7 +7,7 @@ import {
import classNames from "classnames";
import * as React from "react";
-export type GridVariant = "default" | "inverted" | "uniform";
+export type GridVariant = "default" | "inverted";
export interface GridProps extends WithStyles<typeof styles> {
children: React.ReactNodeArray | React.ReactNode;
variant?: GridVariant;
@@ -24,15 +24,11 @@ const styles = (theme: Theme) =>
root: {
display: "grid",
gridColumnGap: theme.spacing.unit * 2 + "px",
+ gridRowGap: theme.spacing.unit * 3 + "px",
[theme.breakpoints.down("sm")]: {
- "& > div": {
- marginBottom: theme.spacing.unit
- },
+ gridRowGap: theme.spacing.unit + "px",
gridTemplateColumns: "1fr"
}
- },
- uniform: {
- gridTemplateColumns: "1fr 1fr"
}
});
@@ -42,8 +38,7 @@ export const Grid = withStyles(styles, { name: "Grid" })(
className={classNames({
[classes.root]: true,
[classes.default]: variant === "default",
- [classes.inverted]: variant === "inverted",
- [classes.uniform]: variant === "uniform"
+ [classes.inverted]: variant === "inverted"
})}
>
{children}
diff --git a/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx b/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx
index ef9307d070..c105b0c9b8 100644
--- a/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx
@@ -13,6 +13,7 @@ import CardTitle from "../../../components/CardTitle";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
+import Grid from "../../../components/Grid";
import PageHeader from "../../../components/PageHeader";
import SaveButtonBar from "../../../components/SaveButtonBar";
import Skeleton from "../../../components/Skeleton";
@@ -33,11 +34,6 @@ const styles = (theme: Theme) =>
margin: `0 auto ${theme.spacing.unit * 2}px`,
maxWidth: 552,
padding: theme.spacing.unit * 2
- },
- root: {
- display: "grid",
- gridColumnGap: theme.spacing.unit * 2 + "px",
- gridTemplateColumns: "4fr 9fr"
}
});
@@ -80,7 +76,7 @@ const ProductImagePage = withStyles(styles, { name: "ProductImagePage" })(
return (
<Container width="md">
<PageHeader title={i18n.t("Edit Photo")} onBack={onBack} />
- <div className={classes.root}>
+ <Grid variant="inverted">
<div>
<ProductImageNavigation
disabled={disabled}
@@ -118,7 +114,7 @@ const ProductImagePage = withStyles(styles, { name: "ProductImagePage" })(
</CardContent>
</Card>
</div>
- </div>
+ </Grid>
<SaveButtonBar
disabled={disabled || !onSubmit || !hasChanged}
state={saveButtonBarState}
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx b/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
index ab6979c5f4..bf2e2988b0 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
@@ -1,14 +1,9 @@
-import {
- createStyles,
- Theme,
- withStyles,
- WithStyles
-} from "@material-ui/core/styles";
import * as React from "react";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
+import Grid from "../../../components/Grid";
import PageHeader from "../../../components/PageHeader";
import SaveButtonBar from "../../../components/SaveButtonBar";
import i18n from "../../../i18n";
@@ -32,20 +27,7 @@ interface FormData {
sku?: string;
}
-const styles = (theme: Theme) =>
- createStyles({
- root: {
- display: "grid",
- gridGap: `${theme.spacing.unit * 2}px`,
- gridTemplateColumns: "4fr 9fr",
- [theme.breakpoints.down("sm")]: {
- gridGap: `${theme.spacing.unit}px`,
- gridTemplateColumns: "1fr"
- }
- }
- });
-
-interface ProductVariantCreatePageProps extends WithStyles<typeof styles> {
+interface ProductVariantCreatePageProps {
currencySymbol: string;
errors: UserError[];
header: string;
@@ -57,96 +39,91 @@ interface ProductVariantCreatePageProps extends WithStyles<typeof styles> {
onVariantClick: (variantId: string) => void;
}
-const ProductVariantCreatePage = withStyles(styles, {
- name: "ProductVariantCreatePage"
-})(
- ({
- classes,
- currencySymbol,
- errors: formErrors,
- loading,
- header,
- product,
- saveButtonBarState,
- onBack,
- onSubmit,
- onVariantClick
- }: ProductVariantCreatePageProps) => {
- const initialForm = {
- attributes: maybe(() =>
- product.productType.variantAttributes.map(attribute => ({
- slug: attribute.slug,
- value: ""
- }))
- ),
- costPrice: "",
- images: maybe(() => product.images.map(image => image.id)),
- priceOverride: "",
- quantity: 0,
- sku: ""
- };
- return (
- <Form
- initial={initialForm}
- errors={formErrors}
- onSubmit={onSubmit}
- key={product ? JSON.stringify(product) : "noproduct"}
- >
- {({ change, data, errors, hasChanged, submit }) => (
- <Container width="md">
- <PageHeader title={header} onBack={onBack} />
- <div className={classes.root}>
- <div>
- <ProductVariantNavigation
- variants={maybe(() => product.variants)}
- onRowClick={(variantId: string) => {
- if (product && product.variants) {
- return onVariantClick(variantId);
- }
- }}
- />
- </div>
- <div>
- <ProductVariantAttributes
- attributes={maybe(
- () => product.productType.variantAttributes
- )}
- data={data}
- disabled={loading}
- onChange={change}
- />
- <ProductVariantPrice
- errors={errors}
- priceOverride={data.priceOverride}
- currencySymbol={currencySymbol}
- costPrice={data.costPrice}
- loading={loading}
- onChange={change}
- />
- <ProductVariantStock
- errors={errors}
- sku={data.sku}
- quantity={data.quantity}
- loading={loading}
- onChange={change}
- />
- </div>
+const ProductVariantCreatePage: React.StatelessComponent<
+ ProductVariantCreatePageProps
+> = ({
+ currencySymbol,
+ errors: formErrors,
+ loading,
+ header,
+ product,
+ saveButtonBarState,
+ onBack,
+ onSubmit,
+ onVariantClick
+}) => {
+ const initialForm = {
+ attributes: maybe(() =>
+ product.productType.variantAttributes.map(attribute => ({
+ slug: attribute.slug,
+ value: ""
+ }))
+ ),
+ costPrice: "",
+ images: maybe(() => product.images.map(image => image.id)),
+ priceOverride: "",
+ quantity: 0,
+ sku: ""
+ };
+ return (
+ <Form
+ initial={initialForm}
+ errors={formErrors}
+ onSubmit={onSubmit}
+ key={product ? JSON.stringify(product) : "noproduct"}
+ >
+ {({ change, data, errors, hasChanged, submit }) => (
+ <Container width="md">
+ <PageHeader title={header} onBack={onBack} />
+ <Grid variant="inverted">
+ <div>
+ <ProductVariantNavigation
+ variants={maybe(() => product.variants)}
+ onRowClick={(variantId: string) => {
+ if (product && product.variants) {
+ return onVariantClick(variantId);
+ }
+ }}
+ />
+ </div>
+ <div>
+ <ProductVariantAttributes
+ attributes={maybe(() => product.productType.variantAttributes)}
+ data={data}
+ disabled={loading}
+ onChange={change}
+ />
+ <ProductVariantPrice
+ errors={errors}
+ priceOverride={data.priceOverride}
+ currencySymbol={currencySymbol}
+ costPrice={data.costPrice}
+ loading={loading}
+ onChange={change}
+ />
+ <ProductVariantStock
+ errors={errors}
+ sku={data.sku}
+ quantity={data.quantity}
+ loading={loading}
+ onChange={change}
+ />
</div>
- <SaveButtonBar
- disabled={loading || !onSubmit || !hasChanged}
- labels={{
- delete: i18n.t("Remove variant"),
- save: i18n.t("Save variant")
- }}
- state={saveButtonBarState}
- onCancel={onBack}
- onSave={submit}
- />
- </Container>
- )}
- </Form>
- );
- }
-);
+ </Grid>
+ <SaveButtonBar
+ disabled={loading || !onSubmit || !hasChanged}
+ labels={{
+ delete: i18n.t("Remove variant"),
+ save: i18n.t("Save variant")
+ }}
+ state={saveButtonBarState}
+ onCancel={onBack}
+ onSave={submit}
+ />
+ </Container>
+ )}
+ </Form>
+ );
+};
ProductVariantCreatePage.displayName = "ProductVariantCreatePage";
export default ProductVariantCreatePage;
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantImages/ProductVariantImages.tsx b/saleor/static/dashboard-next/products/components/ProductVariantImages/ProductVariantImages.tsx
index cdc74557d5..ed4a78a175 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantImages/ProductVariantImages.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantImages/ProductVariantImages.tsx
@@ -17,12 +17,6 @@ import { ProductImage } from "../../types/ProductImage";
const styles = (theme: Theme) =>
createStyles({
- card: {
- marginTop: theme.spacing.unit * 2,
- [theme.breakpoints.down("sm")]: {
- marginTop: 0
- }
- },
gridElement: {
"& img": {
width: "100%"
@@ -58,7 +52,7 @@ interface ProductVariantImagesProps extends WithStyles<typeof styles> {
export const ProductVariantImages = withStyles(styles, {
name: "ProductVariantImages"
})(({ classes, disabled, images, onImageAdd }: ProductVariantImagesProps) => (
- <Card className={classes.card}>
+ <Card>
<CardTitle
title={i18n.t("Images")}
toolbar={
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx b/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx
index 6ccd7c3147..e9e059e469 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx
@@ -1,14 +1,10 @@
-import {
- createStyles,
- Theme,
- withStyles,
- WithStyles
-} from "@material-ui/core/styles";
import * as React from "react";
+import CardSpacer from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
+import Grid from "../../../components/Grid";
import PageHeader from "../../../components/PageHeader";
import SaveButtonBar from "../../../components/SaveButtonBar";
import Toggle from "../../../components/Toggle";
@@ -22,20 +18,7 @@ import ProductVariantNavigation from "../ProductVariantNavigation";
import ProductVariantPrice from "../ProductVariantPrice";
import ProductVariantStock from "../ProductVariantStock";
-const styles = (theme: Theme) =>
- createStyles({
- root: {
- display: "grid",
- gridGap: `${theme.spacing.unit * 2}px`,
- gridTemplateColumns: "4fr 9fr",
- [theme.breakpoints.down("sm")]: {
- gridGap: `${theme.spacing.unit}px`,
- gridTemplateColumns: "1fr"
- }
- }
- });
-
-interface ProductVariantPageProps extends WithStyles<typeof styles> {
+interface ProductVariantPageProps {
variant?: ProductVariant;
errors: UserError[];
saveButtonBarState: ConfirmButtonTransitionState;
@@ -49,148 +32,148 @@ interface ProductVariantPageProps extends WithStyles<typeof styles> {
onVariantClick(variantId: string);
}
-const ProductVariantPage = withStyles(styles, { name: "ProductVariantPage" })(
- ({
- classes,
- errors: formErrors,
- loading,
- header,
- placeholderImage,
- saveButtonBarState,
- variant,
- onBack,
- onDelete,
- onImageSelect,
- onSubmit,
- onVariantClick
- }: ProductVariantPageProps) => {
- const variantImages = variant ? variant.images.map(image => image.id) : [];
- const productImages = variant
- ? variant.product.images.sort((prev, next) =>
- prev.sortOrder > next.sortOrder ? 1 : -1
- )
- : undefined;
- const images = productImages
- ? productImages
- .filter(image => variantImages.indexOf(image.id) !== -1)
- .sort((prev, next) => (prev.sortOrder > next.sortOrder ? 1 : -1))
- : undefined;
- return (
- <Toggle>
- {(isImageSelectModalActive, { toggle: toggleImageSelectModal }) => (
- <>
- <Container width="md">
- <PageHeader title={header} onBack={onBack} />
- <Form
- initial={{
- attributes:
- variant && variant.attributes
- ? variant.attributes.map(a => ({
- slug: a.attribute.slug,
- value: a.value.slug
- }))
- : [],
- costPrice:
- variant && variant.costPrice
- ? variant.costPrice.amount.toString()
- : null,
- priceOverride:
- variant && variant.priceOverride
- ? variant.priceOverride.amount.toString()
- : null,
- quantity: variant && variant.quantity ? variant.quantity : "",
- sku: variant && variant.sku
- }}
- errors={formErrors}
- onSubmit={onSubmit}
- confirmLeave
- >
- {({ change, data, errors, hasChanged, submit }) => (
- <>
- <div className={classes.root}>
- <div>
- <ProductVariantNavigation
- current={variant ? variant.id : undefined}
- variants={maybe(() => variant.product.variants)}
- onRowClick={(variantId: string) => {
- if (variant) {
- return onVariantClick(variantId);
- }
- }}
- />
- </div>
- <div>
- <ProductVariantAttributes
- attributes={
- variant && variant.attributes
- ? variant.attributes.map(a => a.attribute)
- : undefined
- }
- data={data}
- disabled={loading}
- onChange={change}
- />
- <ProductVariantImages
- disabled={loading}
- images={images}
- placeholderImage={placeholderImage}
- onImageAdd={toggleImageSelectModal}
- />
- <ProductVariantPrice
- errors={errors}
- priceOverride={data.priceOverride}
- currencySymbol={
- variant && variant.priceOverride
- ? variant.priceOverride.currency
- : variant && variant.costPrice
- ? variant.costPrice.currency
- : ""
+const ProductVariantPage: React.StatelessComponent<ProductVariantPageProps> = ({
+ errors: formErrors,
+ loading,
+ header,
+ placeholderImage,
+ saveButtonBarState,
+ variant,
+ onBack,
+ onDelete,
+ onImageSelect,
+ onSubmit,
+ onVariantClick
+}) => {
+ const variantImages = variant ? variant.images.map(image => image.id) : [];
+ const productImages = variant
+ ? variant.product.images.sort((prev, next) =>
+ prev.sortOrder > next.sortOrder ? 1 : -1
+ )
+ : undefined;
+ const images = productImages
+ ? productImages
+ .filter(image => variantImages.indexOf(image.id) !== -1)
+ .sort((prev, next) => (prev.sortOrder > next.sortOrder ? 1 : -1))
+ : undefined;
+ return (
+ <Toggle>
+ {(isImageSelectModalActive, { toggle: toggleImageSelectModal }) => (
+ <>
+ <Container width="md">
+ <PageHeader title={header} onBack={onBack} />
+ <Form
+ initial={{
+ attributes:
+ variant && variant.attributes
+ ? variant.attributes.map(a => ({
+ slug: a.attribute.slug,
+ value: a.value.slug
+ }))
+ : [],
+ costPrice:
+ variant && variant.costPrice
+ ? variant.costPrice.amount.toString()
+ : null,
+ priceOverride:
+ variant && variant.priceOverride
+ ? variant.priceOverride.amount.toString()
+ : null,
+ quantity: variant && variant.quantity ? variant.quantity : "",
+ sku: variant && variant.sku
+ }}
+ errors={formErrors}
+ onSubmit={onSubmit}
+ confirmLeave
+ >
+ {({ change, data, errors, hasChanged, submit }) => (
+ <>
+ <Grid variant="inverted">
+ <div>
+ <ProductVariantNavigation
+ current={variant ? variant.id : undefined}
+ variants={maybe(() => variant.product.variants)}
+ onRowClick={(variantId: string) => {
+ if (variant) {
+ return onVariantClick(variantId);
}
- costPrice={data.costPrice}
- loading={loading}
- onChange={change}
- />
- <ProductVariantStock
- errors={errors}
- sku={data.sku}
- quantity={data.quantity}
- stockAllocated={
- variant ? variant.quantityAllocated : undefined
- }
- loading={loading}
- onChange={change}
- />
- </div>
+ }}
+ />
+ </div>
+ <div>
+ <ProductVariantAttributes
+ attributes={
+ variant && variant.attributes
+ ? variant.attributes.map(a => a.attribute)
+ : undefined
+ }
+ data={data}
+ disabled={loading}
+ onChange={change}
+ />
+ <CardSpacer />
+ <ProductVariantImages
+ disabled={loading}
+ images={images}
+ placeholderImage={placeholderImage}
+ onImageAdd={toggleImageSelectModal}
+ />
+ <CardSpacer />
+ <ProductVariantPrice
+ errors={errors}
+ priceOverride={data.priceOverride}
+ currencySymbol={
+ variant && variant.priceOverride
+ ? variant.priceOverride.currency
+ : variant && variant.costPrice
+ ? variant.costPrice.currency
+ : ""
+ }
+ costPrice={data.costPrice}
+ loading={loading}
+ onChange={change}
+ />
+ <CardSpacer />
+ <ProductVariantStock
+ errors={errors}
+ sku={data.sku}
+ quantity={data.quantity}
+ stockAllocated={
+ variant ? variant.quantityAllocated : undefined
+ }
+ loading={loading}
+ onChange={change}
+ />
</div>
- <SaveButtonBar
- disabled={loading || !hasChanged}
- state={saveButtonBarState}
- onCancel={onBack}
- onDelete={onDelete}
- onSave={submit}
- />
- </>
+ </Grid>
+ <SaveButtonBar
+ disabled={loading || !hasChanged}
+ state={saveButtonBarState}
+ onCancel={onBack}
+ onDelete={onDelete}
+ onSave={submit}
+ />
+ </>
+ )}
+ </Form>
+ </Container>
+ {variant && (
+ <>
+ <ProductVariantImageSelectDialog
+ onClose={toggleImageSelectModal}
+ onImageSelect={onImageSelect}
+ open={isImageSelectModalActive}
+ images={productImages}
+ selectedImages={maybe(() =>
+ variant.images.map(image => image.id)
)}
- </Form>
- </Container>
- {variant && (
- <>
- <ProductVariantImageSelectDialog
- onClose={toggleImageSelectModal}
- onImageSelect={onImageSelect}
- open={isImageSelectModalActive}
- images={productImages}
- selectedImages={maybe(() =>
- variant.images.map(image => image.id)
- )}
- />
- </>
- )}
- </>
- )}
- </Toggle>
- );
- }
-);
+ />
+ </>
+ )}
+ </>
+ )}
+ </Toggle>
+ );
+};
ProductVariantPage.displayName = "ProductVariantPage";
export default ProductVariantPage;
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantPrice/ProductVariantPrice.tsx b/saleor/static/dashboard-next/products/components/ProductVariantPrice/ProductVariantPrice.tsx
index 7f161d9594..08fdb79adf 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantPrice/ProductVariantPrice.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantPrice/ProductVariantPrice.tsx
@@ -18,12 +18,6 @@ const styles = (theme: Theme) =>
display: "grid",
gridColumnGap: `${theme.spacing.unit * 2}px`,
gridTemplateColumns: "1fr 1fr"
- },
- root: {
- marginTop: theme.spacing.unit * 2,
- [theme.breakpoints.down("sm")]: {
- marginTop: theme.spacing.unit
- }
}
});
@@ -46,7 +40,7 @@ const ProductVariantPrice = withStyles(styles, { name: "ProductVariantPrice" })(
loading,
onChange
}: ProductVariantPriceProps) => (
- <Card className={classes.root}>
+ <Card>
<CardTitle title={i18n.t("Pricing")} />
<CardContent>
<div className={classes.grid}>
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantStock/ProductVariantStock.tsx b/saleor/static/dashboard-next/products/components/ProductVariantStock/ProductVariantStock.tsx
index 657063404e..7846aac3aa 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantStock/ProductVariantStock.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantStock/ProductVariantStock.tsx
@@ -18,12 +18,6 @@ const styles = (theme: Theme) =>
display: "grid",
gridColumnGap: `${theme.spacing.unit * 2}px`,
gridTemplateColumns: "1fr 1fr"
- },
- root: {
- marginTop: theme.spacing.unit * 2,
- [theme.breakpoints.down("sm")]: {
- marginTop: theme.spacing.unit
- }
}
});
@@ -49,7 +43,7 @@ const ProductVariantStock = withStyles(styles, { name: "ProductVariantStock" })(
loading,
onChange
}: ProductVariantStockProps) => (
- <Card className={classes.root}>
+ <Card>
<CardTitle title={i18n.t("Stock")} />
<CardContent>
<div className={classes.grid}>
diff --git a/saleor/static/dashboard-next/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx b/saleor/static/dashboard-next/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx
index 1edb96926c..4af3b99b78 100644
--- a/saleor/static/dashboard-next/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx
+++ b/saleor/static/dashboard-next/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx
@@ -1,15 +1,10 @@
-import {
- createStyles,
- Theme,
- withStyles,
- WithStyles
-} from "@material-ui/core/styles";
import Typography from "@material-ui/core/Typography";
import * as React from "react";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
+import Grid from "../../../components/Grid";
import PageHeader from "../../../components/PageHeader";
import SaveButtonBar from "../../../components/SaveButtonBar";
import i18n from "../../../i18n";
@@ -25,17 +20,7 @@ export interface SiteSettingsPageFormData {
name: string;
}
-const styles = (theme: Theme) =>
- createStyles({
- root: {
- display: "grid",
- gridColumnGap: theme.spacing.unit * 2 + "px",
- gridRowGap: theme.spacing.unit * 3 + "px",
- gridTemplateColumns: "4fr 9fr"
- }
- });
-
-export interface SiteSettingsPageProps extends WithStyles<typeof styles> {
+export interface SiteSettingsPageProps {
disabled: boolean;
errors: Array<{
field: string;
@@ -49,66 +34,63 @@ export interface SiteSettingsPageProps extends WithStyles<typeof styles> {
onSubmit: (data: SiteSettingsPageFormData) => void;
}
-const SiteSettingsPage = withStyles(styles, { name: "SiteSettingsPage" })(
- ({
- classes,
- disabled,
- errors,
- saveButtonBarState,
- shop,
- onBack,
- onKeyAdd,
- onKeyRemove,
- onSubmit
- }: SiteSettingsPageProps) => {
- const initialForm: SiteSettingsPageFormData = {
- description: maybe(() => shop.description, ""),
- domain: maybe(() => shop.domain.host, ""),
- name: maybe(() => shop.name, "")
- };
- return (
- <Form
- errors={errors}
- initial={initialForm}
- onSubmit={onSubmit}
- confirmLeave
- >
- {({ change, data, errors: formErrors, hasChanged, submit }) => (
- <Container width="md">
- <PageHeader
- title={i18n.t("General Information", {
- context: "page header"
- })}
+const SiteSettingsPage: React.StatelessComponent<SiteSettingsPageProps> = ({
+ disabled,
+ errors,
+ saveButtonBarState,
+ shop,
+ onBack,
+ onKeyAdd,
+ onKeyRemove,
+ onSubmit
+}) => {
+ const initialForm: SiteSettingsPageFormData = {
+ description: maybe(() => shop.description, ""),
+ domain: maybe(() => shop.domain.host, ""),
+ name: maybe(() => shop.name, "")
+ };
+ return (
+ <Form
+ errors={errors}
+ initial={initialForm}
+ onSubmit={onSubmit}
+ confirmLeave
+ >
+ {({ change, data, errors: formErrors, hasChanged, submit }) => (
+ <Container width="md">
+ <PageHeader
+ title={i18n.t("General Information", {
+ context: "page header"
+ })}
+ />
+ <Grid variant="inverted">
+ <Typography variant="title">{i18n.t("Site Settings")}</Typography>
+ <SiteSettingsDetails
+ data={data}
+ errors={formErrors}
+ disabled={disabled}
+ onChange={change}
/>
- <div className={classes.root}>
- <Typography variant="title">{i18n.t("Site Settings")}</Typography>
- <SiteSettingsDetails
- data={data}
- errors={formErrors}
- disabled={disabled}
- onChange={change}
- />
- <Typography variant="title">
- {i18n.t("Authentication keys")}
- </Typography>
- <SiteSettingsKeys
- disabled={disabled}
- keys={maybe(() => shop.authorizationKeys)}
- onAdd={onKeyAdd}
- onRemove={onKeyRemove}
- />
- </div>
- <SaveButtonBar
- state={saveButtonBarState}
- disabled={disabled || !hasChanged}
- onCancel={onBack}
- onSave={submit}
+ <Typography variant="title">
+ {i18n.t("Authentication keys")}
+ </Typography>
+ <SiteSettingsKeys
+ disabled={disabled}
+ keys={maybe(() => shop.authorizationKeys)}
+ onAdd={onKeyAdd}
+ onRemove={onKeyRemove}
/>
- </Container>
- )}
- </Form>
- );
- }
-);
+ </Grid>
+ <SaveButtonBar
+ state={saveButtonBarState}
+ disabled={disabled || !hasChanged}
+ onCancel={onBack}
+ onSave={submit}
+ />
+ </Container>
+ )}
+ </Form>
+ );
+};
SiteSettingsPage.displayName = "SiteSettingsPage";
export default SiteSettingsPage;