Skip to content

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

Enable adding collection's alt text when creating new

dominik-zeglencbbba38a7083
diff --git a/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx b/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx
index 195fd665ab..049c15ffa3 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx
@@ -27,6 +27,7 @@ export interface CollectionCreatePageFormData {
url: string;
value: string;
};
+ backgroundImageAlt: string;
description: string;
name: string;
isPublished: boolean;
@@ -56,6 +57,7 @@ const initialForm: CollectionCreatePageFormData = {
url: null,
value: null
},
+ backgroundImageAlt: "",
description: "",
isPublished: false,
name: "",
@@ -95,7 +97,11 @@ const CollectionCreatePage = withStyles(styles, {
<CollectionImage
image={
data.backgroundImage.url
- ? { __typename: "Image", url: data.backgroundImage.url }
+ ? {
+ __typename: "Image",
+ alt: data.backgroundImageAlt,
+ url: data.backgroundImage.url
+ }
: null
}
onImageDelete={() =>
@@ -120,6 +126,8 @@ const CollectionCreatePage = withStyles(styles, {
}
} as any)
}
+ onChange={change}
+ data={data}
/>
<CardSpacer />
<SeoForm
diff --git a/saleor/static/dashboard-next/collections/components/CollectionImage/CollectionImage.tsx b/saleor/static/dashboard-next/collections/components/CollectionImage/CollectionImage.tsx
index 87d1328dad..bacce05d56 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionImage/CollectionImage.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionImage/CollectionImage.tsx
@@ -17,7 +17,6 @@ import ImageTile from "../../../components/ImageTile";
import Skeleton from "../../../components/Skeleton";
import i18n from "../../../i18n";
import { CollectionDetails_collection_backgroundImage } from "../../types/CollectionDetails";
-import { CollectionDetailsPageFormData } from "../CollectionDetailsPage/CollectionDetailsPage";
const styles = (theme: Theme) =>
createStyles({
@@ -53,7 +52,9 @@ const styles = (theme: Theme) =>
});
export interface CollectionImageProps extends WithStyles<typeof styles> {
- data: CollectionDetailsPageFormData;
+ data: {
+ backgroundImageAlt: string;
+ };
image: CollectionDetails_collection_backgroundImage;
onChange: (event: React.ChangeEvent<any>) => void;
onImageDelete: () => void;
diff --git a/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx b/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx
index 3c13997d73..de7376c659 100644
--- a/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx
+++ b/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx
@@ -50,6 +50,7 @@ export const CollectionCreate: React.StatelessComponent<{}> = () => (
variables: {
input: {
backgroundImage: formData.backgroundImage.value,
+ backgroundImageAlt: formData.backgroundImageAlt,
description: formData.description,
isPublished: formData.isPublished,
name: formData.name,