From 57b5da1e79b87774dcf0d8858e5bde4b49ede2be Mon Sep 17 00:00:00 2001 From: iamtrazy Date: Sun, 21 Jul 2024 00:58:56 +0530 Subject: [PATCH] fix: proper navigations from cart to checkout --- src/components/User/Cart/index.tsx | 131 ++++++++++++------------- src/components/User/Checkout/index.tsx | 20 ++-- src/pages/Checkout/index.tsx | 9 +- 3 files changed, 77 insertions(+), 83 deletions(-) diff --git a/src/components/User/Cart/index.tsx b/src/components/User/Cart/index.tsx index cf89ab3..571ac15 100644 --- a/src/components/User/Cart/index.tsx +++ b/src/components/User/Cart/index.tsx @@ -1,12 +1,12 @@ -import React from 'react'; import Food from '@images/product/pizza.png'; import { Checkbox } from '@nextui-org/react'; import QtySelector from './QtySelector'; -// import { Link } from '@nextui-org/react'; import { Link } from 'react-router-dom'; -import { Button } from "@nextui-org/react"; +import { Button } from '@nextui-org/react'; +import { useNavigate } from 'react-router-dom'; function index() { + const navigate = useNavigate(); const item = [ { id: '01', @@ -88,10 +88,12 @@ function index() { className="rounded-xl border dark:border-foodbg dark:bg-foodbg p-2 shadow-sm md:px-6 backdrop-blur-md" style={{ backgroundColor: 'rgba(255, 255, 255, 0.01)' }} > - -
- +
- - {alsoBoughtItems.map((_: any) => { - return ( -
- - imac image - -
- - Cheese Pizza + {alsoBoughtItems.map((_: any) => { + return ( +
+ + imac image -

- Indulge in our classic Cheese Pizza, featuring.. -

-
-
-

- Rs. - 3500 -

-
-
- + Cheese Pizza + +

+ Indulge in our classic Cheese Pizza, featuring.. +

+
+
+

+ Rs. + 3500 +

+
+
+ +
-
- ); - })} + ); + })}
@@ -256,14 +257,12 @@ function index() { - navigate('/checkout')} > - - + Proceed to Checkout +
diff --git a/src/components/User/Checkout/index.tsx b/src/components/User/Checkout/index.tsx index a0c7d2d..3ce56a9 100644 --- a/src/components/User/Checkout/index.tsx +++ b/src/components/User/Checkout/index.tsx @@ -1,8 +1,8 @@ -import React from 'react'; -import { Link } from 'react-router-dom'; import { Button } from '@nextui-org/react'; +import { useNavigate } from 'react-router-dom'; function index() { + const navigate = useNavigate(); return (
diff --git a/src/pages/Checkout/index.tsx b/src/pages/Checkout/index.tsx index 19403f5..b7365f0 100644 --- a/src/pages/Checkout/index.tsx +++ b/src/pages/Checkout/index.tsx @@ -1,10 +1,7 @@ -import React from 'react' -import Checkout from '@components/User/Checkout/index.tsx' +import Checkout from '@components/User/Checkout/index.tsx'; function index() { - return ( - - ) + return ; } -export default index \ No newline at end of file +export default index;