From 2fdda2db5512e36913a653dece98e255e63cfba6 Mon Sep 17 00:00:00 2001 From: Dawid Tarasiuk Date: Tue, 16 Jun 2020 12:48:57 +0200 Subject: [PATCH] Update product list UI --- .../components/ProductList/ProductList.tsx | 35 +- src/products/fixtures.ts | 20 + src/products/queries.ts | 1 + src/products/types/ProductFragment.ts | 1 + src/products/types/ProductList.ts | 1 + .../__snapshots__/Stories.test.ts.snap | 600 +++++++++++++++--- 6 files changed, 568 insertions(+), 90 deletions(-) diff --git a/src/products/components/ProductList/ProductList.tsx b/src/products/components/ProductList/ProductList.tsx index 8a0e48cd6..043ac7584 100644 --- a/src/products/components/ProductList/ProductList.tsx +++ b/src/products/components/ProductList/ProductList.tsx @@ -62,9 +62,17 @@ const useStyles = makeStyles( } }, colNameFixed: {}, + colNameGrid: { + display: "grid", + gridColumn: 1 + }, colNameHeader: { marginLeft: AVATAR_MARGIN }, + colNameType: { + color: theme.palette.text.secondary, + fontSize: "0.8rem" + }, colPrice: { textAlign: "right" }, @@ -297,7 +305,21 @@ export const ProductList: React.FC = props => { thumbnail={maybe(() => product.thumbnail.url)} data-tc="name" > - {maybe(() => product.name, )} + {maybe( + () => ( +
+ {product.name} + {product && product.productType && ( + + {product.productType.hasVariants + ? "Configurable" + : "Simple"} + + )} +
+ ), + + )} = props => { } else { return ( <> - {intl.formatMessage({ - defaultMessage: "From", - description: "from" - })}{" "} {" "} - {intl.formatMessage({ - defaultMessage: "to", - description: "to" - })}{" "} + /> + {" - "} - Nebula Night Sky Paint +
+ + Nebula Night Sky Paint + + + Configurable + +
@@ -124803,7 +124814,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $15.00 to $49.00 + $15.00 - $49.00 - Light Speed Yellow Paint +
+ + Light Speed Yellow Paint + + + Configurable + +
@@ -124868,7 +124890,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $15.00 to $49.00 + $15.00 - $49.00 - Hyperspace Turquoise Paint +
+ + Hyperspace Turquoise Paint + + + Configurable + +
@@ -124933,7 +124966,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $15.00 to $49.00 + $15.00 - $49.00 - Pineapple Juice +
+ + Pineapple Juice + + + Configurable + +
@@ -124998,7 +125042,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Coconut Juice +
+ + Coconut Juice + + + Configurable + +
@@ -125063,7 +125118,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Apple Juice +
+ + Apple Juice + + + Configurable + +
@@ -125128,7 +125194,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Orange Juice +
+ + Orange Juice + + + Configurable + +
@@ -125193,7 +125270,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Banana Juice +
+ + Banana Juice + + + Configurable + +
@@ -125258,7 +125346,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Bean Juice +
+ + Bean Juice + + + Configurable + +
@@ -125323,7 +125422,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Carrot Juice +
+ + Carrot Juice + + + Configurable + +
@@ -125388,7 +125498,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Green Juice +
+ + Green Juice + + + Configurable + +
@@ -125453,7 +125574,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Code Division T-shirt +
+ + Code Division T-shirt + + + Configurable + +
@@ -125518,7 +125650,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Polo Shirt +
+ + Polo Shirt + + + Configurable + +
@@ -125583,7 +125726,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Polo Shirt +
+ + Polo Shirt + + + Configurable + +
@@ -125648,7 +125802,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Polo Shirt +
+ + Polo Shirt + + + Configurable + +
@@ -125713,7 +125878,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Polo Shirt +
+ + Polo Shirt + + + Configurable + +
@@ -125778,7 +125954,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Black Hoodie +
+ + Black Hoodie + + + Configurable + +
@@ -125843,7 +126030,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Blue Hoodie +
+ + Blue Hoodie + + + Configurable + +
@@ -125908,7 +126106,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Mustard Hoodie +
+ + Mustard Hoodie + + + Configurable + +
@@ -125973,7 +126182,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Colored Parrot Cushion +
+ + Colored Parrot Cushion + + + Configurable + +
@@ -126038,7 +126258,7 @@ exports[`Storyshots Views / Products / Product list default 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 @@ -127374,7 +127594,18 @@ exports[`Storyshots Views / Products / Product list not published 1`] = `
- Light Speed Yellow Paint +
+ + Light Speed Yellow Paint + + + Configurable + +
@@ -127398,7 +127629,7 @@ exports[`Storyshots Views / Products / Product list not published 1`] = ` - From $15.00 to $49.00 + $15.00 - $49.00 - Hyperspace Turquoise Paint +
+ + Hyperspace Turquoise Paint + + + Configurable + +
@@ -127463,7 +127705,7 @@ exports[`Storyshots Views / Products / Product list not published 1`] = ` - From $15.00 to $49.00 + $15.00 - $49.00 - Bean Juice +
+ + Bean Juice + + + Configurable + +
@@ -127528,7 +127781,7 @@ exports[`Storyshots Views / Products / Product list not published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Black Hoodie +
+ + Black Hoodie + + + Configurable + +
@@ -127593,7 +127857,7 @@ exports[`Storyshots Views / Products / Product list not published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Colored Parrot Cushion +
+ + Colored Parrot Cushion + + + Configurable + +
@@ -127658,7 +127933,7 @@ exports[`Storyshots Views / Products / Product list not published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 @@ -128100,7 +128375,18 @@ exports[`Storyshots Views / Products / Product list published 1`] = `
- Nebula Night Sky Paint +
+ + Nebula Night Sky Paint + + + Configurable + +
@@ -128124,7 +128410,7 @@ exports[`Storyshots Views / Products / Product list published 1`] = ` - From $15.00 to $49.00 + $15.00 - $49.00 - Pineapple Juice +
+ + Pineapple Juice + + + Configurable + +
@@ -128189,7 +128486,7 @@ exports[`Storyshots Views / Products / Product list published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Coconut Juice +
+ + Coconut Juice + + + Configurable + +
@@ -128254,7 +128562,7 @@ exports[`Storyshots Views / Products / Product list published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Apple Juice +
+ + Apple Juice + + + Configurable + +
@@ -128319,7 +128638,7 @@ exports[`Storyshots Views / Products / Product list published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Orange Juice +
+ + Orange Juice + + + Configurable + +
@@ -128384,7 +128714,7 @@ exports[`Storyshots Views / Products / Product list published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Banana Juice +
+ + Banana Juice + + + Configurable + +
@@ -128449,7 +128790,7 @@ exports[`Storyshots Views / Products / Product list published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Carrot Juice +
+ + Carrot Juice + + + Configurable + +
@@ -128514,7 +128866,7 @@ exports[`Storyshots Views / Products / Product list published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Green Juice +
+ + Green Juice + + + Configurable + +
@@ -128579,7 +128942,7 @@ exports[`Storyshots Views / Products / Product list published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Code Division T-shirt +
+ + Code Division T-shirt + + + Configurable + +
@@ -128644,7 +129018,7 @@ exports[`Storyshots Views / Products / Product list published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Polo Shirt +
+ + Polo Shirt + + + Configurable + +
@@ -128709,7 +129094,7 @@ exports[`Storyshots Views / Products / Product list published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Polo Shirt +
+ + Polo Shirt + + + Configurable + +
@@ -128774,7 +129170,7 @@ exports[`Storyshots Views / Products / Product list published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Polo Shirt +
+ + Polo Shirt + + + Configurable + +
@@ -128839,7 +129246,7 @@ exports[`Storyshots Views / Products / Product list published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Polo Shirt +
+ + Polo Shirt + + + Configurable + +
@@ -128904,7 +129322,7 @@ exports[`Storyshots Views / Products / Product list published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Blue Hoodie +
+ + Blue Hoodie + + + Configurable + +
@@ -128969,7 +129398,7 @@ exports[`Storyshots Views / Products / Product list published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00 - Mustard Hoodie +
+ + Mustard Hoodie + + + Configurable + +
@@ -129034,7 +129474,7 @@ exports[`Storyshots Views / Products / Product list published 1`] = ` - From $3.00 to $7.00 + $3.00 - $7.00