Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove unnecessary cards in create Category Page and normalize margins
Lukasz Szewczyk4f9ceb4ac7b7
diff --git a/saleor/static/dashboard-next/categories/components/CategoryBackground/CategoryBackground.tsx b/saleor/static/dashboard-next/categories/components/CategoryBackground/CategoryBackground.tsxindex 256fc81b87..13105316be 100644--- a/saleor/static/dashboard-next/categories/components/CategoryBackground/CategoryBackground.tsx+++ b/saleor/static/dashboard-next/categories/components/CategoryBackground/CategoryBackground.tsx@@ -85,7 +85,7 @@ const decorate = withStyles(theme => ({},imageOverlayToolbar: {display: "flex" as "flex",- justifyContent: "center",+ justifyContent: "flex-end",position: "relative" as "relative",top: "-10px"}diff --git a/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx b/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsxindex abea1acff2..e4a9a659bc 100644--- a/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx+++ b/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx@@ -1,7 +1,7 @@import { withStyles } from "@material-ui/core/styles";-// import DialogContentText from "@material-ui/core/DialogContentText";import * as React from "react";+import { CardSpacer } from "../../../components/CardSpacer";import Form from "../../../components/Form";import Container from "../../../components/Container";import PageHeader from "../../../components/PageHeader";@@ -9,10 +9,9 @@ import { UserError } from "../../../";import i18n from "../../../i18n";import CategoryDetailsForm from "../../components/CategoryDetailsForm";import SeoForm from "../../../components/SeoForm";-import CategoryBackground from "../CategoryBackground";-import CategoryCreateSubcategories from "../CategoryCreateSubcategories";import Toggle from "../../../components/Toggle";-import CategoryDeleteDialog from "../../components/CategoryDeleteDialog";+import ActionDialog from "../../../components/ActionDialog";+import DialogContentText from "@material-ui/core/DialogContentText";import SaveButtonBar, {SaveButtonBarState@@ -28,14 +27,11 @@ interface FormData {export interface CategoryCreatePageProps {errors: UserError[];header: string;- placeholderImage: string;disabled: boolean;onSubmit(data: FormData);- onImageUpload?(event: React.ChangeEvent<any>);onBack();onDelete();saveButtonBarState?: SaveButtonBarState;- onImageDelete: (id: string) => () => void;}const decorate = withStyles(theme => ({root: {@@ -47,17 +43,13 @@ const decorate = withStyles(theme => ({export const CategoryCreatePage = decorate<CategoryCreatePageProps>(({- classes,header,disabled,onSubmit,onBack,errors: userErrors,onDelete,- saveButtonBarState,- onImageUpload,- onImageDelete,- placeholderImage+ saveButtonBarState}) => {const initialData: FormData = {name: "",@@ -73,20 +65,15 @@ export const CategoryCreatePage = decorate<CategoryCreatePageProps>(<><Container width="lg"><PageHeader title={header} />- <div className={classes.root}>+ <div><CategoryDetailsFormdisabled={disabled}data={data}onChange={change}errors={errors}/>- <CategoryBackground- onImageUpload={onImageUpload}- onImageDelete={onImageDelete}- placeholderImage={placeholderImage}- disabled={disabled}- />- <CategoryCreateSubcategories disabled={disabled} />+ <CardSpacer />+ <CardSpacer /><SeoFormhelperText={i18n.t("Add search engine title and description to make this product easier to find"@@ -112,12 +99,21 @@ export const CategoryCreatePage = decorate<CategoryCreatePageProps>(/></div></Container>- <CategoryDeleteDialog- name={undefined}+ <ActionDialog+ title={i18n.t("Remove category")}open={openedDeleteDialog}onClose={toggleDeleteDialog}onConfirm={onDelete}- />+ variant={"delete"}+ >+ <DialogContentText+ dangerouslySetInnerHTML={{+ __html: i18n.t(+ "Are you sure you want to remove this category"+ )+ }}+ />+ </ActionDialog></>)}</Form>diff --git a/saleor/static/dashboard-next/categories/components/CategoryCreateSubcategories/CategoryCreateSubcategories.tsx b/saleor/static/dashboard-next/categories/components/CategoryCreateSubcategories/CategoryCreateSubcategories.tsxindex bf5ec27da4..a87df08b3a 100644--- a/saleor/static/dashboard-next/categories/components/CategoryCreateSubcategories/CategoryCreateSubcategories.tsx+++ b/saleor/static/dashboard-next/categories/components/CategoryCreateSubcategories/CategoryCreateSubcategories.tsx@@ -24,7 +24,7 @@ interface CategoryCreateSubcategoriesProps {}const decorate = withStyles(theme => ({- root: {+ inputGrid: {display: "grid",gridColumnGap: theme.spacing.unit * 2 + "px",gridTemplateColumns: "5fr 8fr 30px",@@ -38,7 +38,14 @@ const decorate = withStyles(theme => ({alignSelf: "end"},addSubCat: {- padding: "0px"+ padding: "0",+ marginTop: ".5rem"+ },+ root: {+ paddingBottom: "0px",+ "&:last-child": {+ paddingBottom: ".5rem"+ }}}));@@ -62,7 +69,7 @@ export const CategoryCreateSubcategories = decorate<</Button>}/>- <CardContent>+ <CardContent className={classNames({ [classes.root]: toggled })}><TypographyclassName={classNames({ [classes.helperText]: toggled })}>@@ -70,14 +77,10 @@ export const CategoryCreateSubcategories = decorate<</Typography>{toggled && (<>- <div className={classes.root}>+ <div className={classes.inputGrid}><TextField label={i18n.t("Category Name")} /><TextField label={i18n.t("Category Description")} />- <IconButton- className={classes.deleteIcon}- color="secondary"- // onClick={onImageDelete}- >+ <IconButton className={classes.deleteIcon} color="secondary"><DeleteIcon /></IconButton></div>diff --git a/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx b/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsxindex b951911f4a..e2f090dfc6 100644--- a/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx+++ b/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx@@ -12,7 +12,6 @@ import CategoryDetailsForm from "../../components/CategoryDetailsForm";import SeoForm from "../../../components/SeoForm";import Form from "../../../components/Form";import CategoryProductsCard from "../CategoryProductsCard";-import ActionDialog from "../../../components/ActionDialog";import { MoneyType } from "../../../products";import Toggle from "../../../components/Toggle";@@ -23,6 +22,7 @@ import Tabs, { SingleTab } from "../../../components/Tab";import { UserError } from "../../../";import i18n from "../../../i18n";+import { CardSpacer } from "../../../components/CardSpacer";interface FormData {description: string;@@ -87,7 +87,6 @@ export interface CategoryUpdatePageProps {const decorate = withStyles(theme => ({root: {- display: "grid",marginTop: theme.spacing.unit * 2,gridGap: theme.spacing.unit * 4 + "px"},@@ -126,7 +125,7 @@ export const CategoryUpdatePage = decorate<CategoryUpdatePageProps>(name: category.name,description: category.description,seoTitle: category.SeoTitle,- seoDescription: category.SeoTitle+ seoDescription: category.SeoDescription}: {name: "",@@ -141,7 +140,7 @@ export const CategoryUpdatePage = decorate<CategoryUpdatePageProps>(<Form onSubmit={onSubmit} initial={initialData} errors={userErrors}>{({ data, change, errors, submit, hasChanged }) => (<>- <Container width="lg">+ <Container width="md"><PageHeadertitle={isRoot@@ -171,12 +170,14 @@ export const CategoryUpdatePage = decorate<CategoryUpdatePageProps>(errors={errors}onChange={change}/>+ <CardSpacer /><CategoryBackgroundonImageUpload={onImageUpload}onImageDelete={onImageDelete}backgroundImage={backgroundImage}placeholderImage={placeholderImage}/>+ <CardSpacer /><SeoFormhelperText={i18n.t("Add search engine title and description to make this product easier to find"@@ -189,6 +190,7 @@ export const CategoryUpdatePage = decorate<CategoryUpdatePageProps>(onChange={change}disabled={disabled}/>+ <CardSpacer /></>)}{isRoot && (@@ -219,6 +221,7 @@ export const CategoryUpdatePage = decorate<CategoryUpdatePageProps>(>Products</SingleTab>+ <CardSpacer /></div>{currentTab === 0 && (<CategoryList@@ -242,6 +245,7 @@ export const CategoryUpdatePage = decorate<CategoryUpdatePageProps>(</>)}</Tabs>+<SaveButtonBaronCancel={onBack}onDelete={toggleDeleteDialog}@@ -268,8 +272,7 @@ export const CategoryUpdatePage = decorate<CategoryUpdatePageProps>(<DialogContentTextdangerouslySetInnerHTML={{__html: i18n.t(- "Are you sure you want to remove <strong>{{ name }}</strong>?"- // { name: category.name }+ "Are you sure you want to remove this category")}}/>diff --git a/saleor/static/dashboard-next/storybook/stories/categories/CategoryCreatePage.tsx b/saleor/static/dashboard-next/storybook/stories/categories/CategoryCreatePage.tsxindex 15e45e6cea..bfd562f963 100644--- a/saleor/static/dashboard-next/storybook/stories/categories/CategoryCreatePage.tsx+++ b/saleor/static/dashboard-next/storybook/stories/categories/CategoryCreatePage.tsx@@ -1,6 +1,5 @@import { storiesOf } from "@storybook/react";import * as React from "react";-import * as placeholderImage from "../../../../images/placeholder255x255.png";import CategoryCreatePage, {CategoryCreatePageProps@@ -13,9 +12,7 @@ const createProps: CategoryCreatePageProps = {errors: [],onBack: () => undefined,onSubmit: () => undefined,- onDelete: () => undefined,- placeholderImage: placeholderImage,- onImageDelete: () => undefined+ onDelete: () => undefined};storiesOf("Views / Categories / Create category", module)