ShoppingCart.js 3.97 KB
Newer Older
Kim, Subin's avatar
Kim, Subin committed
1
import React, { useState, useEffect, useRef } from 'react';
Kim, Subin's avatar
Kim, Subin committed
2
3
4
import { Redirect } from 'react-router-dom';
import MainNav from '../Components/MainNav';
import SubNav from '../Components/SubNav';
5
import { Card, Button, Container, Row, Col } from 'react-bootstrap';
Kim, Subin's avatar
Kim, Subin committed
6
7

function ShoppingCart() {
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
    const [num, setNum] = useState(0)

    function plusNum() {
        setNum(num + 1)
    }
    function minusNum() {
        if (num === 0) {
            setNum(0)
        }
        else {
            setNum(num - 1)

        }
    }
    function deleteCart() {
        //장바구니 DB에서 해당 항목 삭제 
        console.log('카트에 담긴 항목을 삭제했습니다.')
    }

Kim, Subin's avatar
Kim, Subin committed
27
28
    return (
        <div>
Kim, Subin's avatar
Kim, Subin committed
29
30
            <MainNav />
            <SubNav />
31
            <Container className="justify-content-center">
Jiwon Yoon's avatar
Jiwon Yoon committed
32
                <h3 className="my-5 font-weight-bold text-center">장바구니</h3>
33
                <div>
Jiwon Yoon's avatar
Jiwon Yoon committed
34
                    <h4 className="font-weight-bold py-3 border-top border-bottom text-center" style={{ background: '#F7F3F3' }}>주문상품정보</h4>
35
                    <Card>
36
37
38
39
40
                        <Row className="mx-1">
                            <Col xs={2} sm={2} className="text-center my-auto">
                                <input className="" type="checkbox" id="exampleCheck1" />
                            </Col>
                            <Col className="text-center">
kusang96's avatar
dd    
kusang96 committed
41
                                <Card.Img className="img-fluid" variant="top" src="icon/asd.jpg" style={{ width: '20rem' }} />
42
                            </Col>
43
                            <Col md={6} className="p-2">
44
                                <Card.Body>
45
                                    <input type="image" src="https://img.icons8.com/fluent-systems-regular/24/000000/close-window.png" className="float-right" onClick={deleteCart} />
46
47
48
49
                                    <Card.Title className="font-weight-bold mt-3">제품명</Card.Title>
                                    <Card.Text>가격</Card.Text>
                                    <Card.Text>옵션</Card.Text>
                                    <Card.Text>수량</Card.Text>
50
51
52
53
                                    <div>
                                        <input type="image" src="https://img.icons8.com/ios-glyphs/20/000000/minus-math.png" className="align-middle" onClick={minusNum} />
                                        <input type="text" style={{ width: '30px' }} className="text-center align-middle mx-1" placeholder="1" value={num} readOnly></input>
                                        <input type="image" src="https://img.icons8.com/ios-glyphs/20/000000/plus-math.png" className="align-middle" onClick={plusNum} />
54
55
56
57
58
59
                                    </div>
                                </Card.Body>
                            </Col>
                        </Row>
                    </Card>
                </div>
60
                <div className="p-5 m-5" style={{ background: '#F7F3F3' }}>
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
                    <ul className="pl-0" style={{ listStyle: 'none' }}>
                        <li>
                            <span className="text-secondary"> 상품금액</span>
                            <span className="text-secondary float-right">12,000</span>
                        </li>
                        <li>
                            <span className="text-secondary">배송비</span>
                            <span className="text-secondary float-right">2,500</span>
                        </li>
                    </ul>
                    <div className="my-1 pt-2 border-top font-weight-bold">
                        결제금액<span className="float-right">14,500</span>
                    </div>
                </div>
                <div className="text-center">
Jiwon Yoon's avatar
Jiwon Yoon committed
76
                    <Button className="px-5" style={{ background: "#91877F", borderColor: '#91877F' }} href="/payment" block>결제하기</Button>
77
78
79
                </div>
            </Container>

Kim, Subin's avatar
Kim, Subin committed
80
81
82
83
84
        </div>
    )
}

export default ShoppingCart