From abd2e9eae4e819e157a1a4e3820e1b8375f553f0 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 28 Dec 2022 10:41:30 +0700 Subject: Progress Bar Component --- src/components/ProgressBar.js | 26 ++++++++++++++++++++++++++ src/pages/shop/cart.js | 41 +++++++++++++++++------------------------ src/pages/shop/checkout.js | 17 +++++++++++++++++ 3 files changed, 60 insertions(+), 24 deletions(-) create mode 100644 src/components/ProgressBar.js create mode 100644 src/pages/shop/checkout.js (limited to 'src') diff --git a/src/components/ProgressBar.js b/src/components/ProgressBar.js new file mode 100644 index 00000000..cdb55205 --- /dev/null +++ b/src/components/ProgressBar.js @@ -0,0 +1,26 @@ +import { CheckIcon } from "@heroicons/react/24/outline"; +import { CheckCircleIcon } from "@heroicons/react/24/solid"; + +const ProgressBar = ({ current, labels }) => { + return ( +
+ {labels.map((label, index) => ( + <> +
+
+ { index + 1 } +
+

{ label }

+
+ { index < (labels.length - 1) && ( +
+
+
+ ) } + + ))} +
+ ) +} + +export default ProgressBar; \ No newline at end of file diff --git a/src/pages/shop/cart.js b/src/pages/shop/cart.js index 452289b4..5a228077 100644 --- a/src/pages/shop/cart.js +++ b/src/pages/shop/cart.js @@ -6,6 +6,7 @@ import { MinusIcon, } from "@heroicons/react/24/solid"; import { ExclamationTriangleIcon } from "@heroicons/react/24/outline"; +import { useRouter } from "next/router"; // Helpers import { @@ -25,8 +26,10 @@ import Link from "../../components/Link"; import Alert from "../../components/Alert"; import Spinner from "../../components/Spinner"; import AppBar from "../../components/AppBar"; +import ProgressBar from "../../components/ProgressBar"; export default function Cart() { + const router = useRouter(); const [isLoadingProducts, setIsLoadingProducts] = useState(true); const [products, setProducts] = useState([]); const [totalPriceBeforeTax, setTotalPriceBeforeTax] = useState(0); @@ -158,28 +161,12 @@ export default function Cart() { - {/* jsx-start: Progress Bar */} -
-
-
1
-

Keranjang

-
-
-
-
-
-
2
-

Pembayaran

-
-
-
-
-
-
3
-

Selesai

-
-
- {/* [End] Progress Bar */} + + +
{/* --- Start Alert */} {!isLoadingProducts && ( @@ -204,9 +191,11 @@ export default function Cart() { )} +
+
{/* [Start] Product List */} -
+
{products.map((product, index) => (
@@ -271,7 +260,11 @@ export default function Cart() { ))}
{/* [End] Product List */} +
+
+ +
{/* [Start] Review Order */} {products.length > 0 ? (
@@ -321,13 +314,13 @@ export default function Cart() {
) : ''} {/* [End] Submit Button */} -
diff --git a/src/pages/shop/checkout.js b/src/pages/shop/checkout.js new file mode 100644 index 00000000..48cbc10e --- /dev/null +++ b/src/pages/shop/checkout.js @@ -0,0 +1,17 @@ +import AppBar from "../../components/AppBar"; +import Layout from "../../components/Layout"; +import ProgressBar from "../../components/ProgressBar"; + + +export default function Checkout() { + return ( + + + + + + ) +} \ No newline at end of file -- cgit v1.2.3