Skip to content

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

Update types and snapshots

dominik-zeglen39e805ac2156
diff --git a/saleor/static/dashboard-next/components/ImageUpload/ImageUpload.tsx b/saleor/static/dashboard-next/components/ImageUpload/ImageUpload.tsx
index f7f24a53d9..a0a8a3fa14 100644
--- a/saleor/static/dashboard-next/components/ImageUpload/ImageUpload.tsx
+++ b/saleor/static/dashboard-next/components/ImageUpload/ImageUpload.tsx
@@ -105,7 +105,7 @@ export const ImageUpload = withStyles(styles, { name: "ImageUpload" })(
</Typography>
</div>
</div>
- {children({ isDragActive })}
+ {children && children({ isDragActive })}
</>
)}
</Dropzone>
diff --git a/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap b/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap
index f70b617532..89c51ec541 100644
--- a/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap
+++ b/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap
@@ -13347,36 +13347,40 @@ exports[`Storyshots Views / Collections / Create collection default 1`] = `
class="ImageUpload-photosIconContainer-id"
tabindex="0"
>
- <input
- autocomplete="off"
- class="ImageUpload-fileField-id"
- multiple=""
- style="display:none"
- tabindex="-1"
- type="file"
- />
- <svg
- aria-hidden="true"
- class="MuiSvgIcon-root-id ImageUpload-photosIcon-id"
- focusable="false"
- role="presentation"
- viewBox="0 0 24 24"
+ <div
+ class=""
>
- <defs>
+ <input
+ autocomplete="off"
+ class="ImageUpload-fileField-id"
+ multiple=""
+ style="display:none"
+ tabindex="-1"
+ type="file"
+ />
+ <svg
+ aria-hidden="true"
+ class="MuiSvgIcon-root-id ImageUpload-photosIcon-id"
+ focusable="false"
+ role="presentation"
+ viewBox="0 0 24 24"
+ >
+ <defs>
+ <path
+ d="M24 24H0V0h24v24z"
+ id="a"
+ />
+ </defs>
<path
- d="M24 24H0V0h24v24z"
- id="a"
+ d="M3 4V1h2v3h3v2H5v3H3V6H0V4h3zm3 6V7h3V4h7l1.83 2H21c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V10h3zm7 9c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-3.2-5c0 1.77 1.43 3.2 3.2 3.2s3.2-1.43 3.2-3.2-1.43-3.2-3.2-3.2-3.2 1.43-3.2 3.2z"
/>
- </defs>
- <path
- d="M3 4V1h2v3h3v2H5v3H3V6H0V4h3zm3 6V7h3V4h7l1.83 2H21c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V10h3zm7 9c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-3.2-5c0 1.77 1.43 3.2 3.2 3.2s3.2-1.43 3.2-3.2-1.43-3.2-3.2-3.2-3.2 1.43-3.2 3.2z"
- />
- </svg>
- <p
- class="MuiTypography-root-id MuiTypography-body2-id ImageUpload-uploadText-id"
- >
- Drop here to upload
- </p>
+ </svg>
+ <p
+ class="MuiTypography-root-id MuiTypography-body2-id ImageUpload-uploadText-id"
+ >
+ Drop here to upload
+ </p>
+ </div>
</div>
</div>
<div
@@ -13755,36 +13759,40 @@ exports[`Storyshots Views / Collections / Create collection loading 1`] = `
class="ImageUpload-photosIconContainer-id"
tabindex="0"
>
- <input
- autocomplete="off"
- class="ImageUpload-fileField-id"
- multiple=""
- style="display:none"
- tabindex="-1"
- type="file"
- />
- <svg
- aria-hidden="true"
- class="MuiSvgIcon-root-id ImageUpload-photosIcon-id"
- focusable="false"
- role="presentation"
- viewBox="0 0 24 24"
+ <div
+ class=""
>
- <defs>
+ <input
+ autocomplete="off"
+ class="ImageUpload-fileField-id"
+ multiple=""
+ style="display:none"
+ tabindex="-1"
+ type="file"
+ />
+ <svg
+ aria-hidden="true"
+ class="MuiSvgIcon-root-id ImageUpload-photosIcon-id"
+ focusable="false"
+ role="presentation"
+ viewBox="0 0 24 24"
+ >
+ <defs>
+ <path
+ d="M24 24H0V0h24v24z"
+ id="a"
+ />
+ </defs>
<path
- d="M24 24H0V0h24v24z"
- id="a"
+ d="M3 4V1h2v3h3v2H5v3H3V6H0V4h3zm3 6V7h3V4h7l1.83 2H21c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V10h3zm7 9c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-3.2-5c0 1.77 1.43 3.2 3.2 3.2s3.2-1.43 3.2-3.2-1.43-3.2-3.2-3.2-3.2 1.43-3.2 3.2z"
/>
- </defs>
- <path
- d="M3 4V1h2v3h3v2H5v3H3V6H0V4h3zm3 6V7h3V4h7l1.83 2H21c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V10h3zm7 9c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-3.2-5c0 1.77 1.43 3.2 3.2 3.2s3.2-1.43 3.2-3.2-1.43-3.2-3.2-3.2-3.2 1.43-3.2 3.2z"
- />
- </svg>
- <p
- class="MuiTypography-root-id MuiTypography-body2-id ImageUpload-uploadText-id"
- >
- Drop here to upload
- </p>
+ </svg>
+ <p
+ class="MuiTypography-root-id MuiTypography-body2-id ImageUpload-uploadText-id"
+ >
+ Drop here to upload
+ </p>
+ </div>
</div>
</div>
<div
@@ -46763,90 +46771,133 @@ exports[`Storyshots Views / Products / Product edit when data is fully loaded 1`
class="CardTitle-hr-id"
/>
<div
- class="MuiCardContent-root-id"
+ class="ProductImages-imageGridContainer-id"
>
<div
- class="ProductImages-root-id"
+ class="ImageUpload-photosIconContainer-id ProductImages-imageUpload-id"
+ tabindex="0"
>
<div
- class="ImageTile-imageContainer-id"
+ class="ProductImages-imageUploadIcon-id"
>
- <div
- class="ImageTile-imageOverlay-id"
+ <input
+ autocomplete="off"
+ class="ImageUpload-fileField-id"
+ multiple=""
+ style="display:none"
+ tabindex="-1"
+ type="file"
+ />
+ <svg
+ aria-hidden="true"
+ class="MuiSvgIcon-root-id ImageUpload-photosIcon-id"
+ focusable="false"
+ role="presentation"
+ viewBox="0 0 24 24"
>
- <div
- class="ImageTile-imageOverlayToolbar-id"
+ <defs>
+ <path
+ d="M24 24H0V0h24v24z"
+ id="a"
+ />
+ </defs>
+ <path
+ d="M3 4V1h2v3h3v2H5v3H3V6H0V4h3zm3 6V7h3V4h7l1.83 2H21c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V10h3zm7 9c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-3.2-5c0 1.77 1.43 3.2 3.2 3.2s3.2-1.43 3.2-3.2-1.43-3.2-3.2-3.2-3.2 1.43-3.2 3.2z"
/>
- </div>
- <img
- alt="Id sit dolores adipisci"
- class="ImageTile-image-id"
- src="placeholder255x255.png"
- />
+ </svg>
+ <p
+ class="MuiTypography-root-id MuiTypography-body2-id ImageUpload-uploadText-id"
+ >
+ Drop here to upload
+ </p>
</div>
+ </div>
+ <div
+ class="MuiCardContent-root-id"
+ >
<div
- class="ImageTile-imageContainer-id"
+ class="ProductImages-root-id"
>
<div
- class="ImageTile-imageOverlay-id"
+ class="ImageTile-imageContainer-id"
>
<div
- class="ImageTile-imageOverlayToolbar-id"
+ class="ImageTile-imageOverlay-id"
+ >
+ <div
+ class="ImageTile-imageOverlayToolbar-id"
+ />
+ </div>
+ <img
+ alt="Id sit dolores adipisci"
+ class="ImageTile-image-id"
+ src="placeholder255x255.png"
/>
</div>
- <img
- alt="Id sit dolores adipisci"
- class="ImageTile-image-id"
- src="placeholder255x255.png"
- />
- </div>
- <div
- class="ImageTile-imageContainer-id"
- >
<div
- class="ImageTile-imageOverlay-id"
+ class="ImageTile-imageContainer-id"
>
<div
- class="ImageTile-imageOverlayToolbar-id"
+ class="ImageTile-imageOverlay-id"
+ >
+ <div
+ class="ImageTile-imageOverlayToolbar-id"
+ />
+ </div>
+ <img
+ alt="Id sit dolores adipisci"
+ class="ImageTile-image-id"
+ src="placeholder255x255.png"
/>
</div>
- <img
- alt="Id sit dolores adipisci"
- class="ImageTile-image-id"
- src="placeholder255x255.png"
- />
- </div>
- <div
- class="ImageTile-imageContainer-id"
- >
<div
- class="ImageTile-imageOverlay-id"
+ class="ImageTile-imageContainer-id"
>
<div
- class="ImageTile-imageOverlayToolbar-id"
+ class="ImageTile-imageOverlay-id"
+ >
+ <div
+ class="ImageTile-imageOverlayToolbar-id"
+ />
+ </div>
+ <img
+ alt="Id sit dolores adipisci"
+ class="ImageTile-image-id"
+ src="placeholder255x255.png"
/>
</div>
- <img
- alt="Id sit dolores adipisci"
- class="ImageTile-image-id"
- src="placeholder255x255.png"
- />
- </div>
- <div
- class="ImageTile-imageContainer-id"
- >
<div
- class="ImageTile-imageOverlay-id"
+ class="ImageTile-imageContainer-id"
>
<div
- class="ImageTile-imageOverlayToolbar-id"
+ class="ImageTile-imageOverlay-id"
+ >
+ <div
+ class="ImageTile-imageOverlayToolbar-id"
+ />
+ </div>
+ <img
+ alt="Id sit dolores adipisci"
+ class="ImageTile-image-id"
+ src="placeholder255x255.png"
+ />
+ </div>
+ <div
+ class="ImageTile-imageContainer-id"
+ >
+ <div
+ class="ImageTile-imageOverlay-id"
+ >
+ <div
+ class="ImageTile-imageOverlayToolbar-id"
+ />
+ </div>
+ <img
+ alt="Id sit dolores adipisci"
+ class="ImageTile-image-id"
+ src="placeholder255x255.png"
/>
</div>
- <img
- alt="Id sit dolores adipisci"
- class="ImageTile-image-id"
- src="placeholder255x255.png"
- />
</div>
</div>
</div>
@@ -47831,18 +47882,22 @@ exports[`Storyshots Views / Products / Product edit when loading data 1`] = `
class="CardTitle-hr-id"
/>
<div
- class="MuiCardContent-root-id"
+ class="ProductImages-imageGridContainer-id"
>
<div
- class="ProductImages-root-id"
+ class="MuiCardContent-root-id"
>
<div
- class="ProductImages-imageContainer-id"
+ class="ProductImages-root-id"
>
- <img
- class="ProductImages-image-id"
- src="placeholder255x255.png"
- />
+ <div
+ class="ProductImages-imageContainer-id"
+ >
+ <img
+ class="ProductImages-image-id"
+ src="placeholder255x255.png"
+ />
+ </div>
</div>
</div>
</div>
@@ -48628,33 +48683,46 @@ exports[`Storyshots Views / Products / Product edit when product has no images 1
class="CardTitle-hr-id"
/>
<div
- class="MuiCardContent-root-id"
+ class="ProductImages-imageGridContainer-id"
>
<div
- class="ProductImages-noPhotosIconContainer-id"
+ class="ImageUpload-photosIconContainer-id"
+ tabindex="0"
>
- <svg
- aria-hidden="true"
- class="MuiSvgIcon-root-id ProductImages-noPhotosIcon-id"
- focusable="false"
- role="presentation"
- viewBox="0 0 24 24"
+ <div
+ class=""
>
- <defs>
+ <input
+ autocomplete="off"
+ class="ImageUpload-fileField-id"
+ multiple=""
+ style="display:none"
+ tabindex="-1"
+ type="file"
+ />
+ <svg
+ aria-hidden="true"
+ class="MuiSvgIcon-root-id ImageUpload-photosIcon-id"
+ focusable="false"
+ role="presentation"
+ viewBox="0 0 24 24"
+ >
+ <defs>
+ <path
+ d="M24 24H0V0h24v24z"
+ id="a"
+ />
+ </defs>
<path
- d="M24 24H0V0h24v24z"
- id="a"
+ d="M3 4V1h2v3h3v2H5v3H3V6H0V4h3zm3 6V7h3V4h7l1.83 2H21c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V10h3zm7 9c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-3.2-5c0 1.77 1.43 3.2 3.2 3.2s3.2-1.43 3.2-3.2-1.43-3.2-3.2-3.2-3.2 1.43-3.2 3.2z"
/>
- </defs>
- <path
- d="M3 4V1h2v3h3v2H5v3H3V6H0V4h3zm3 6V7h3V4h7l1.83 2H21c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V10h3zm7 9c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-3.2-5c0 1.77 1.43 3.2 3.2 3.2s3.2-1.43 3.2-3.2-1.43-3.2-3.2-3.2-3.2 1.43-3.2 3.2z"
- />
- </svg>
- <p
- class="MuiTypography-root-id MuiTypography-body1-id ProductImages-noPhotosIconText-id"
- >
- Drop images to upload
- </p>
+ </svg>
+ <p
+ class="MuiTypography-root-id MuiTypography-body2-id ImageUpload-uploadText-id"
+ >
+ Drop here to upload
+ </p>
+ </div>
</div>
</div>
</div>
@@ -49635,90 +49703,133 @@ exports[`Storyshots Views / Products / Product edit when product has no variants
class="CardTitle-hr-id"
/>
<div
- class="MuiCardContent-root-id"
+ class="ProductImages-imageGridContainer-id"
>
<div
- class="ProductImages-root-id"
+ class="ImageUpload-photosIconContainer-id ProductImages-imageUpload-id"
+ tabindex="0"
>
<div
- class="ImageTile-imageContainer-id"
+ class="ProductImages-imageUploadIcon-id"
>
- <div
- class="ImageTile-imageOverlay-id"
+ <input
+ autocomplete="off"
+ class="ImageUpload-fileField-id"
+ multiple=""
+ style="display:none"
+ tabindex="-1"
+ type="file"
+ />
+ <svg
+ aria-hidden="true"
+ class="MuiSvgIcon-root-id ImageUpload-photosIcon-id"
+ focusable="false"
+ role="presentation"
+ viewBox="0 0 24 24"
>
- <div
- class="ImageTile-imageOverlayToolbar-id"
+ <defs>
+ <path
+ d="M24 24H0V0h24v24z"
+ id="a"
+ />
+ </defs>
+ <path
+ d="M3 4V1h2v3h3v2H5v3H3V6H0V4h3zm3 6V7h3V4h7l1.83 2H21c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V10h3zm7 9c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-3.2-5c0 1.77 1.43 3.2 3.2 3.2s3.2-1.43 3.2-3.2-1.43-3.2-3.2-3.2-3.2 1.43-3.2 3.2z"
/>
- </div>
- <img
- alt="Id sit dolores adipisci"
- class="ImageTile-image-id"
- src="placeholder255x255.png"
- />
+ </svg>
+ <p
+ class="MuiTypography-root-id MuiTypography-body2-id ImageUpload-uploadText-id"
+ >
+ Drop here to upload
+ </p>
</div>
+ </div>
+ <div
+ class="MuiCardContent-root-id"
+ >
<div
- class="ImageTile-imageContainer-id"
+ class="ProductImages-root-id"
>
<div
- class="ImageTile-imageOverlay-id"
+ class="ImageTile-imageContainer-id"
>
<div
- class="ImageTile-imageOverlayToolbar-id"
+ class="ImageTile-imageOverlay-id"
+ >
+ <div
+ class="ImageTile-imageOverlayToolbar-id"
+ />
+ </div>
+ <img
+ alt="Id sit dolores adipisci"
+ class="ImageTile-image-id"
+ src="placeholder255x255.png"
/>
</div>
- <img
- alt="Id sit dolores adipisci"
- class="ImageTile-image-id"
- src="placeholder255x255.png"
- />
- </div>
- <div
- class="ImageTile-imageContainer-id"
- >
<div
- class="ImageTile-imageOverlay-id"
+ class="ImageTile-imageContainer-id"
>
<div
- class="ImageTile-imageOverlayToolbar-id"
+ class="ImageTile-imageOverlay-id"
+ >
+ <div
+ class="ImageTile-imageOverlayToolbar-id"
+ />
+ </div>
+ <img
+ alt="Id sit dolores adipisci"
+ class="ImageTile-image-id"
+ src="placeholder255x255.png"
/>
</div>
- <img
- alt="Id sit dolores adipisci"
- class="ImageTile-image-id"
- src="placeholder255x255.png"
- />
- </div>
- <div
- class="ImageTile-imageContainer-id"
- >
<div
- class="ImageTile-imageOverlay-id"
+ class="ImageTile-imageContainer-id"
>
<div
- class="ImageTile-imageOverlayToolbar-id"
+ class="ImageTile-imageOverlay-id"
+ >
+ <div
+ class="ImageTile-imageOverlayToolbar-id"
+ />
+ </div>
+ <img
+ alt="Id sit dolores adipisci"
+ class="ImageTile-image-id"
+ src="placeholder255x255.png"
/>
</div>
- <img
- alt="Id sit dolores adipisci"
- class="ImageTile-image-id"
- src="placeholder255x255.png"
- />
- </div>
- <div
- class="ImageTile-imageContainer-id"
- >
<div
- class="ImageTile-imageOverlay-id"
+ class="ImageTile-imageContainer-id"
>
<div
- class="ImageTile-imageOverlayToolbar-id"
+ class="ImageTile-imageOverlay-id"
+ >
+ <div
+ class="ImageTile-imageOverlayToolbar-id"
+ />
+ </div>
+ <img
+ alt="Id sit dolores adipisci"
+ class="ImageTile-image-id"
+ src="placeholder255x255.png"
+ />
+ </div>
+ <div
+ class="ImageTile-imageContainer-id"
+ >
+ <div
+ class="ImageTile-imageOverlay-id"
+ >
+ <div
+ class="ImageTile-imageOverlayToolbar-id"
+ />
+ </div>
+ <img
+ alt="Id sit dolores adipisci"
+ class="ImageTile-image-id"
+ src="placeholder255x255.png"
/>
</div>
- <img
- alt="Id sit dolores adipisci"
- class="ImageTile-image-id"
- src="placeholder255x255.png"
- />
</div>
</div>
</div>
diff --git a/saleor/static/dashboard-next/storybook/stories/products/ProductUpdatePage.tsx b/saleor/static/dashboard-next/storybook/stories/products/ProductUpdatePage.tsx
index 6d8dd30dac..84f3c3515d 100644
--- a/saleor/static/dashboard-next/storybook/stories/products/ProductUpdatePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/products/ProductUpdatePage.tsx
@@ -31,6 +31,7 @@ storiesOf("Views / Products / Product edit", module)
onVariantAdd={undefined}
onVariantShow={() => undefined}
onImageDelete={() => undefined}
+ onImageUpload={() => undefined}
saveButtonBarState="default"
/>
))
@@ -55,6 +56,7 @@ storiesOf("Views / Products / Product edit", module)
onImageDelete={() => undefined}
onVariantAdd={undefined}
onVariantShow={() => undefined}
+ onImageUpload={() => undefined}
saveButtonBarState="default"
/>
))
@@ -84,6 +86,7 @@ storiesOf("Views / Products / Product edit", module)
onVariantAdd={undefined}
onImageDelete={() => undefined}
onVariantShow={() => undefined}
+ onImageUpload={() => undefined}
saveButtonBarState="default"
/>
))
@@ -102,6 +105,7 @@ storiesOf("Views / Products / Product edit", module)
onDelete={undefined}
onImageDelete={() => undefined}
onVariantShow={() => undefined}
+ onImageUpload={() => undefined}
saveButtonBarState="default"
variants={undefined}
/>