@@ -6,10 +6,10 @@ import { getTotalPrice } from '../../../redux/Slices/Cart/cartSlice';
66import { getSumOfProducts } from '../../../redux/Slices/Cart/cartSlice' ;
77import { useNavigate } from 'react-router-dom' ;
88
9- const Shipping = ( { handleToggle } ) => {
9+ const Shipping = ( ) => {
1010 const navigate = useNavigate ( ) ;
1111 const cartItems = useSelector ( state => state . cart . items )
12- const subTotal = useSelector ( getTotalPrice ) ;
12+ console . log ( cartItems . length )
1313 const tax = 2 ;
1414const total = useSelector ( getSumOfProducts )
1515
@@ -20,57 +20,66 @@ const handleCheckout=()=>{
2020
2121 return (
2222 < >
23+ {
24+ cartItems . length !== 0 ?
2325 < div className = "flex flex-col w-full h-screen items-center " >
24- < div className = "flex lg:flex-row flex-col lg:w-11/12 w-full gap-10 " >
25- < div className = " lg:w-8/12 w-full font-Poppins flex flex-col lg:gap-5 gap-1 " >
26- < div className = "lg:text-3xl text-xl font-medium tracking-tighter p-2 " >
27- Prodcuts
26+ < div className = "flex lg:flex-row flex-col lg:w-11/12 w-full gap-10 " >
27+ < div className = " lg:w-8/12 w-full font-Poppins flex flex-col lg:gap-5 gap-1 " >
28+ < div className = "lg:text-3xl text-xl font-medium tracking-tighter p-2 " >
29+ Prodcuts
30+ </ div >
31+ < div className = "flex flex-col gap-2 w-full p-2 " >
32+ { cartItems . map ( ( items ) => {
33+ return < EachCard items = { items } /> ;
34+ } ) }
35+ </ div >
36+ </ div >
37+ < div className = "h-max lg:w-4/12 w-full lg:pb-5 lg:mt-12 rounded-md transition-all flex flex-col lg:pl-5 lg:pr-5 p-2 " >
38+ < div className = "w-full border-2 p-2 rounded-md lg:text-xl " >
39+ < div className = "font-semibold font-Poppins pb-2 border-b-2 pt-2" >
40+ Order Summary
2841 </ div >
29- < div className = "flex flex-col gap-2 w-full p-2 " >
30- { cartItems . map ( ( items ) => {
31- return < EachCard items = { items } /> ;
32- } ) }
42+ < div className = " font-Poppins flex pb-2" >
43+ { " " }
44+ < div > Subtotal:</ div > < div className = "ml-auto " > $ { total } </ div > { " " }
3345 </ div >
34- </ div >
35- < div className = "h-max lg:w-4/12 w-full lg:pb-5 lg:mt-12 rounded-md transition-all flex flex-col lg:pl-5 lg:pr-5 p-2 " >
36- < div className = "w-full border-2 p-2 rounded-md lg:text-xl " >
37- < div className = "font-semibold font-Poppins pb-2 border-b-2 pt-2" >
38- Order Summary
39- </ div >
40- < div className = " font-Poppins flex pb-2" >
41- { " " }
42- < div > Subtotal:</ div > < div className = "ml-auto " > $ { total } </ div > { " " }
43- </ div >
44- < div className = " font-Poppins flex pb-2" >
45- { " " }
46- < div > Shipping Fee:</ div > { " " }
47- < div className = "ml-auto " > $ { tax } </ div > { " " }
48- </ div >
49- < div className = " font-Poppins flex pb-2" >
46+ < div className = " font-Poppins flex pb-2" >
47+ { " " }
48+ < div > Shipping Fee:</ div > { " " }
49+ < div className = "ml-auto " > $ { tax } </ div > { " " }
50+ </ div >
51+ < div className = " font-Poppins flex pb-2" >
52+ { " " }
53+ < div > Total :</ div > { " " }
54+ < div className = "ml-auto text-red-600 font-semibold" >
5055 { " " }
51- < div > Total :</ div > { " " }
52- < div className = "ml-auto text-red-600 font-semibold" >
53- { " " }
54- $ { total + 2 }
55- </ div > { " " }
56- </ div >
57- < Button
58- className = "flex gap-3 lg:mt-10 mt-2 text-4xl "
59- variant = "solid"
60- bgColor = "black"
61- color = "white"
62- colorScheme = "#ffffff"
63- height = { 12 }
64- _hover = { { bgColor : "#4F5054" , color : "white" } }
65- onClick = { handleCheckout }
66- >
67- < CiShoppingCart className = "text-2xl" />
68- Proceed to checkout
69- </ Button >
56+ $ { total + 2 }
57+ </ div > { " " }
7058 </ div >
59+ < Button
60+ className = "flex gap-3 lg:mt-10 mt-2 text-4xl "
61+ variant = "solid"
62+ bgColor = "black"
63+ color = "white"
64+ colorScheme = "#ffffff"
65+ height = { 12 }
66+ _hover = { { bgColor : "#4F5054" , color : "white" } }
67+ onClick = { handleCheckout }
68+ >
69+ < CiShoppingCart className = "text-2xl" />
70+ Proceed to checkout
71+ </ Button >
7172 </ div >
7273 </ div >
7374 </ div >
75+ </ div > :
76+ < div className = 'w-full h-screen flex justify-center' >
77+ < div className = 'w-11/12 pt-5 text-xl' > No Products in cart</ div >
78+ </ div >
79+ }
80+
81+
82+
7483 </ >
7584 ) ;
7685}
0 commit comments