Fix/cart back navigation #12
@@ -1,9 +1,10 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import {
|
import {
|
||||||
Layout, Typography, List, Button, Empty, Card, Radio, Form, Input,
|
Layout, Typography, List, Button, Empty, Card, Radio, Form, Input,
|
||||||
Checkbox, Modal, message, Tag, Spin, theme
|
Checkbox, Modal, message, Tag, Spin, theme, Space
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { ArrowLeftOutlined } from '@ant-design/icons';
|
||||||
|
import { useNavigate, Link } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
CartItem, ShippingAddress, fetchCart, removeFromCart, fetchAddresses,
|
CartItem, ShippingAddress, fetchCart, removeFromCart, fetchAddresses,
|
||||||
createAddress, createCartPaypalOrder, captureCartPaypalOrder, demoCartPurchase
|
createAddress, createCartPaypalOrder, captureCartPaypalOrder, demoCartPurchase
|
||||||
@@ -133,12 +134,18 @@ export default function Cart() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout style={{ minHeight: '100vh' }}>
|
<Layout style={{ minHeight: '100vh' }}>
|
||||||
<Header style={{ background: token.colorBgContainer, borderBottom: `1px solid ${token.colorBorderSecondary}` }}>
|
<Header style={{ background: token.colorBgContainer, borderBottom: `1px solid ${token.colorBorderSecondary}`, display: 'flex', alignItems: 'center', gap: 16 }}>
|
||||||
<Title level={3} style={{ color: token.colorText, margin: 0, lineHeight: '64px' }}>Your Cart</Title>
|
<Link to="/">
|
||||||
|
<Button icon={<ArrowLeftOutlined />}>Back to Shop</Button>
|
||||||
|
</Link>
|
||||||
|
<Title level={3} style={{ color: token.colorText, margin: 0 }}>Your Cart</Title>
|
||||||
</Header>
|
</Header>
|
||||||
<Content style={{ padding: 24, maxWidth: 700, margin: '0 auto', width: '100%' }}>
|
<Content style={{ padding: 24, maxWidth: 700, margin: '0 auto', width: '100%' }}>
|
||||||
{items.length === 0 ? (
|
{items.length === 0 ? (
|
||||||
|
<Space direction="vertical" align="center" style={{ width: '100%', marginTop: 24 }}>
|
||||||
<Empty description="Your cart is empty" />
|
<Empty description="Your cart is empty" />
|
||||||
|
<Link to="/"><Button type="primary">Continue Shopping</Button></Link>
|
||||||
|
</Space>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<List
|
<List
|
||||||
|
|||||||
Reference in New Issue
Block a user