From 6dae061425f3b51b05a83a48035d70496d4fb6a7 Mon Sep 17 00:00:00 2001
From: paco <34928425+pacocoursey@users.noreply.github.com>
Date: Thu, 8 Oct 2020 18:37:11 -0600
Subject: [PATCH] Add error, empty, success states to cart sidebar
---
.../cart/CartSidebarView/CartSidebarView.tsx | 59 ++++++++++++++-----
components/icon/ArrowLeft.tsx | 11 +++-
components/icon/Check.tsx | 21 +++++++
components/icon/index.ts | 1 +
components/product/Swatch/Swatch.tsx | 19 +-----
tailwind.config.js | 2 +
6 files changed, 78 insertions(+), 35 deletions(-)
create mode 100644 components/icon/Check.tsx
diff --git a/components/cart/CartSidebarView/CartSidebarView.tsx b/components/cart/CartSidebarView/CartSidebarView.tsx
index a5d014d56..85824e6fb 100644
--- a/components/cart/CartSidebarView/CartSidebarView.tsx
+++ b/components/cart/CartSidebarView/CartSidebarView.tsx
@@ -1,7 +1,8 @@
import { FC } from 'react'
+import cn from 'classnames'
import { UserNav } from '@components/core'
import { Button } from '@components/ui'
-import { ArrowLeft } from '@components/icon'
+import { ArrowLeft, Bag, Cross, Check } from '@components/icon'
import { useUI } from '@components/ui/context'
import { useCart } from '@lib/bigcommerce/cart'
import CartItem from '../CartItem'
@@ -15,15 +16,25 @@ const CartSidebarView: FC = () => {
console.log('CART', data, isEmpty)
+ // This should come from the API via hook I guess
+ const error = null
+ const success = null
+
return (
- <>
+
@@ -32,24 +43,42 @@ const CartSidebarView: FC = () => {
- {isEmpty ? (
-
- Your cart is currently empty
-
- ) : (
-
- My Cart
-
- )}
{isEmpty ? (
-
-
+
+
+
+
+
+ Your cart is empty.
+
+
+ ) : error ? (
+
+
+
+
+
+ We couldn’t process the purchase. Please check your card information
+ and try again.
+
+
+ ) : success ? (
+
+
+
+
+
+ Thank you for your order.
+
) : (
<>
>
)}
- >
+
)
}
diff --git a/components/icon/ArrowLeft.tsx b/components/icon/ArrowLeft.tsx
index e85b956e6..ed80ca7a7 100644
--- a/components/icon/ArrowLeft.tsx
+++ b/components/icon/ArrowLeft.tsx
@@ -1,16 +1,21 @@
const ArrowLeft = ({ ...props }) => {
return (
-