-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCartTotals.jsx
More file actions
36 lines (34 loc) · 1.2 KB
/
CartTotals.jsx
File metadata and controls
36 lines (34 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { useSelector } from 'react-redux';
import { formatPrice } from '../utils';
const CartTotals = () => {
const { cartTotal, shipping, tax, orderTotal } = useSelector(
(state) => state.cartState
);
return (
<div className='card bg-base-200'>
<div className='card-body'>
{/* SUBTOTAL */}
<p className='flex justify-between text-xs border-b border-base-300 pb-2'>
<span>Subtotal</span>
<span className='font-medium'>{formatPrice(cartTotal)}</span>
</p>
{/* SHIPPING */}
<p className='flex justify-between text-xs border-b border-base-300 pb-2'>
<span>Shipping</span>
<span className='font-medium'>{formatPrice(shipping)}</span>
</p>
{/* Tax */}
<p className='flex justify-between text-xs border-b border-base-300 pb-2'>
<span>Tax</span>
<span className='font-medium'>{formatPrice(tax)}</span>
</p>
{/* Order Total */}
<p className='flex justify-between text-sm mt-4 pb-2'>
<span>Order Total</span>
<span className='font-medium'>{formatPrice(orderTotal)}</span>
</p>
</div>
</div>
);
};
export default CartTotals;