diff --git a/package-lock.json b/package-lock.json
index d01ddfa..bbd664e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5,6 +5,7 @@
"requires": true,
"packages": {
"": {
+ "name": "react-ecommerce",
"version": "0.0.1",
"dependencies": {
"@headlessui/react": "^1.6.0",
diff --git a/src/Components/Cart.jsx b/src/Components/Cart.jsx
index 917b7a1..3b29653 100644
--- a/src/Components/Cart.jsx
+++ b/src/Components/Cart.jsx
@@ -1,140 +1,179 @@
+import { useEffect } from "react";
import { Dialog, Transition } from "@headlessui/react";
-import { XIcon } from "@heroicons/react/outline";
+import { XIcon, ShoppingCartIcon } from "@heroicons/react/outline";
import React, { Fragment } from "react";
export default function Cart({ open, setOpen, cart, updateCart }) {
- return (
-
-
+
+ );
}
diff --git a/src/Components/NavBar.jsx b/src/Components/NavBar.jsx
index b1d0db9..9e9fff5 100644
--- a/src/Components/NavBar.jsx
+++ b/src/Components/NavBar.jsx
@@ -1,7 +1,9 @@
import { ShoppingBagIcon } from "@heroicons/react/outline";
import React from "react";
-export default function NavBar({ setOpen }) {
+export default function NavBar({ cart, setOpen }) {
+ let cart_items = cart.length
+
return (
@@ -41,7 +43,7 @@ export default function NavBar({ setOpen }) {
className="flex-shrink-0 h-6 w-6 text-gray-400 group-hover:text-gray-500"
aria-hidden="true"
/>
- 0
+ {cart_items}
items in cart, view bag
diff --git a/src/Components/ProductFilters.jsx b/src/Components/ProductFilters.jsx
index 0f3262a..09a8721 100644
--- a/src/Components/ProductFilters.jsx
+++ b/src/Components/ProductFilters.jsx
@@ -7,6 +7,10 @@ function classNames(...classes) {
}
export default function ProductFilters({ filterOptions, setFilterOptions, sortOptions, setSortOptions }) {
+ const sort_list = () => {
+ setSortOptions(sortOptions === 'arc' ? 'desc' : 'asc')
+ }
+
return (
(