Skip to content

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

Add Seo form

Łukasz Szewczykdef3e5597f46
diff --git a/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx b/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx
index 618ad93fb1..453d6bbe8c 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx
@@ -4,7 +4,9 @@ import * as React from "react";
import Form from "../../../components/Form";
import Container from "../../../components/Container";
import PageHeader from "../../../components/PageHeader";
+import SeoForm from "../../../components/SeoForm";
import { UserError } from "../../../";
+import i18n from "../../../i18n";
import CategoryDetailsForm from "../../components/CategoryDetailsForm";
@@ -12,6 +14,10 @@ interface FormData {
//CategoryDetailsForm
description: string;
name: string;
+
+ // SeoForm
+ seoTitle: string;
+ seoDescription: string;
}
interface CategoryCreatePageProps {
@@ -26,27 +32,43 @@ interface CategoryCreatePageProps {
const decorate = withStyles(theme => ({
root: {
display: "grid",
- marginTop: theme.spacing.unit * 2
+ marginTop: theme.spacing.unit * 2,
+ gridGap: theme.spacing.unit * 4 + "px"
}
}));
export const CategoryCreatePage = decorate<CategoryCreatePageProps>(
- ({ header, disabled, onSubmit, errors: userErrors }) => {
+ ({ classes, header, disabled, onSubmit, errors: userErrors }) => {
const initialData: FormData = {
name: "",
- description: ""
+ description: "",
+ seoTitle: "",
+ seoDescription: ""
};
return (
<Form onSubmit={onSubmit} initial={initialData} errors={userErrors}>
{({ data, change, errors }) => (
<Container width="lg">
<PageHeader title={header} />
- <CategoryDetailsForm
- disabled={disabled}
- data={data}
- onChange={change}
- errors={errors}
- />
+ <div className={classes.root}>
+ <CategoryDetailsForm
+ disabled={disabled}
+ data={data}
+ onChange={change}
+ errors={errors}
+ />
+ <SeoForm
+ helperText={i18n.t(
+ "Add search engine title and description to make this product easier to find"
+ )}
+ title={data.seoTitle}
+ titlePlaceholder={data.name}
+ description={data.seoDescription}
+ descriptionPlaceholder={data.description}
+ loading={disabled}
+ onChange={change}
+ />
+ </div>
</Container>
)}
</Form>