Skip to content

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

wip

dominik-zeglenbc2c04d240c6
diff --git a/saleor/static/dashboard-next/categories/components/CategoryDetailsPage/CategoryDetailsPage.tsx b/saleor/static/dashboard-next/categories/components/CategoryDetailsPage/CategoryDetailsPage.tsx
index 556b1d2a87..b6f1f02bd6 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryDetailsPage/CategoryDetailsPage.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryDetailsPage/CategoryDetailsPage.tsx
@@ -1,4 +1,5 @@
import Button from "@material-ui/core/Button";
+import gray from "@material-ui/core/colors/grey";
import { withStyles } from "@material-ui/core/styles";
import AddIcon from "@material-ui/icons/Add";
import * as React from "react";
@@ -48,11 +49,28 @@ interface CategoryDetailsPageProps {
}
const decorate = withStyles(theme => ({
+ actions: {
+ borderTop: `1px ${gray[300]} solid`,
+ display: "flex",
+ marginBottom: theme.spacing.unit * 2,
+ marginTop: theme.spacing.unit * 2,
+ paddingTop: theme.spacing.unit * 2,
+ [theme.breakpoints.down("sm")]: {
+ marginTop: theme.spacing.unit
+ }
+ },
cardContainer: {
marginTop: theme.spacing.unit * 2,
[theme.breakpoints.down("md")]: {
marginTop: theme.spacing.unit
}
+ },
+ deleteButton: {
+ "&:hover": {
+ backgroundColor: theme.palette.error.dark
+ },
+ backgroundColor: theme.palette.error.main,
+ color: theme.palette.error.contrastText
}
}));
const CategoryDetailsPage = decorate<CategoryDetailsPageProps>(
@@ -105,13 +123,12 @@ const CategoryDetailsPage = decorate<CategoryDetailsPageProps>(
<CategoryProperties
description={category ? category.description : undefined}
onEdit={onEdit}
- onDelete={toggleDialog}
/>
)}
<div className={isRoot ? undefined : classes.cardContainer}>
<CategoryList
categories={subcategories}
- displayTitle={!isRoot}
+ isRoot={isRoot}
onAdd={onAddCategory}
onRowClick={onCategoryClick}
/>
@@ -132,6 +149,17 @@ const CategoryDetailsPage = decorate<CategoryDetailsPageProps>(
</div>
)}
</div>
+ {!isRoot && (
+ <div className={classes.actions}>
+ <Button
+ variant="contained"
+ onClick={toggleDialog}
+ className={classes.deleteButton}
+ >
+ {i18n.t("Remove category")}
+ </Button>
+ </div>
+ )}
</Container>
{category && (
<CategoryDeleteDialog
diff --git a/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx b/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
index 0cbfd99347..fdbebd1987 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
@@ -18,24 +18,24 @@ interface CategoryListProps {
id: string;
name: string;
}>;
- displayTitle?: boolean;
+ isRoot: boolean;
onAdd?();
onRowClick?(id: string): () => void;
}
const CategoryList: React.StatelessComponent<CategoryListProps> = ({
categories,
- displayTitle,
+ isRoot,
onAdd,
onRowClick
}) => (
<Card>
- {displayTitle && (
+ {!isRoot && (
<CardTitle
- title={i18n.t("Categories")}
+ title={i18n.t("Subcategories")}
toolbar={
<Button color="secondary" variant="flat" onClick={onAdd}>
- {i18n.t("Add category")}
+ {i18n.t("Add subcategory")}
</Button>
}
/>
diff --git a/saleor/static/dashboard-next/categories/components/CategoryProperties/CategoryProperties.tsx b/saleor/static/dashboard-next/categories/components/CategoryProperties/CategoryProperties.tsx
index 67e5c3013d..f278b279d2 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryProperties/CategoryProperties.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryProperties/CategoryProperties.tsx
@@ -11,26 +11,19 @@ import i18n from "../../../i18n";
interface CategoryPropertiesProps {
description?: string;
onEdit?();
- onDelete?();
}
const CategoryProperties: React.StatelessComponent<CategoryPropertiesProps> = ({
description,
- onDelete,
onEdit
}) => (
<Card>
<CardTitle
title={i18n.t("Details")}
toolbar={
- <>
- <Button variant="flat" color="secondary" onClick={onEdit}>
- {i18n.t("Edit category")}
- </Button>
- <Button variant="flat" color="secondary" onClick={onDelete}>
- {i18n.t("Remove category")}
- </Button>
- </>
+ <Button variant="flat" color="secondary" onClick={onEdit}>
+ {i18n.t("Edit category")}
+ </Button>
}
/>
<CardContent>