Skip to content

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

Handle null background image

dominik-zeglen35501860a29d
diff --git a/saleor/static/dashboard-next/categories/components/CategoryBackground/CategoryBackground.tsx b/saleor/static/dashboard-next/categories/components/CategoryBackground/CategoryBackground.tsx
index 1b46be3b99..dfb44af1ce 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryBackground/CategoryBackground.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryBackground/CategoryBackground.tsx
@@ -53,7 +53,7 @@ const decorate = withStyles(theme => ({
}));
export const CategoryBackground = decorate(
- class CategoryBackgroundClass extends React.Component<
+ class CategoryBackgroundComponent extends React.Component<
CategoryBackgroundProps &
WithStyles<
| "PhotosIcon"
@@ -106,15 +106,15 @@ export const CategoryBackground = decorate(
<img className={classes.image} src={placeholderImage} />
</div>
</div>
- ) : backgroundImage.url ? (
+ ) : backgroundImage === null ? (
+ <div className={classes.PhotosIconContainer}>
+ <AddPhotoIcon className={classes.PhotosIcon} />
+ </div>
+ ) : (
<CategoryBackgroundImage
onImageDelete={onImageDelete}
backgroundImage={backgroundImage}
/>
- ) : (
- <div className={classes.PhotosIconContainer}>
- <AddPhotoIcon className={classes.PhotosIcon} />
- </div>
)}
</CardContent>
</Card>
diff --git a/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx b/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
index e409d5f9ad..8528545f34 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
@@ -128,7 +128,10 @@ export const CategoryUpdatePage = decorate<CategoryUpdatePageProps>(
<Form onSubmit={onSubmit} initial={initialData} errors={userErrors}>
{({ data, change, errors, submit, hasChanged }) => (
<Container width="md">
- <PageHeader title={category ? category.name : undefined} />
+ <PageHeader
+ title={category ? category.name : undefined}
+ onBack={onBack}
+ />
<CategoryDetailsForm
data={data}
disabled={disabled}
diff --git a/saleor/static/dashboard-next/storybook/stories/categories/CategoryUpdatePage.tsx b/saleor/static/dashboard-next/storybook/stories/categories/CategoryUpdatePage.tsx
index fa7a403288..e0e78006c3 100644
--- a/saleor/static/dashboard-next/storybook/stories/categories/CategoryUpdatePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/categories/CategoryUpdatePage.tsx
@@ -19,7 +19,7 @@ const updateProps: CategoryUpdatePageProps = {
loading: false,
onAddCategory: undefined,
onAddProduct: undefined,
- onBack: undefined,
+ onBack: () => undefined,
onCategoryClick: () => undefined,
onDelete: () => undefined,
onImageDelete: () => undefined,