Home.js 6.68 KB
Newer Older
Kim, Subin's avatar
Kim, Subin committed
1
import React, { useState, useEffect, useRef } from 'react';
2
3
4
import ListCard from '../Components/ListCard';
import axios from 'axios';
import catchError from '../utils/catchErrors';
Kim, Subin's avatar
Kim, Subin committed
5
import { Card, Container, Row } from 'react-bootstrap';
6

Kim, Subin's avatar
Kim, Subin committed
7
8

function Home() {
9
10
    const [productlist, setProductlist] = useState([])
    const [error, setError] = useState('')
kusang96's avatar
kusang96 committed
11

12
13
14
15
16
17
18
19
20
21
22
23
24
    useEffect(() => {
        getProductlist()
    }, [])

    async function getProductlist() {
        try {
            const response = await axios.get(`/api/product/getproduct`)
            console.log(response.data)
            setProductlist(response.data)
        } catch (error) {
            catchError(error, setError)
        }
    }
kusang96's avatar
kusang96 committed
25

Kim, Subin's avatar
Kim, Subin committed
26
27
    return (
        <div>
kusang96's avatar
kusang96 committed
28
29
            <Container className="my-5">
                <div className="my-4">
kusang96's avatar
kusang96 committed
30
                    <h2 style={{ marginRight: "5rem", marginLeft: "3rem", marginBottom: "2rem" }}><u>Best</u></h2>
kusang96's avatar
kusang96 committed
31
                    <Row className="justify-content-center mx-0">
32
                        <ListCard productlist={productlist} />
kusang96's avatar
kusang96 committed
33
                        <Card className="mx-1 my-2" style={{ width: '18rem' }}>
34
                            <Card.Img className="img-fluid" variant="top" src="/icon/asd.jpg" />
35
36
37
38
39
                            <Card.Body>
                                <Card.Title className="font-weight-bold">제품명</Card.Title>
                                <Card.Text>가격</Card.Text>
                            </Card.Body>
                        </Card>
kusang96's avatar
kusang96 committed
40
                        <Card className="mx-1 my-2" style={{ width: '18rem' }}>
41
                            <Card.Img className="img-fluid" variant="top" src="/icon/asd.jpg" />
42
43
44
45
46
                            <Card.Body>
                                <Card.Title className="font-weight-bold">제품명</Card.Title>
                                <Card.Text>가격</Card.Text>
                            </Card.Body>
                        </Card>
kusang96's avatar
kusang96 committed
47
                        <Card className="mx-1 my-2" style={{ width: '18rem' }}>
48
                            <Card.Img className="img-fluid" variant="top" src="/icon/asd.jpg" />
49
50
51
52
53
                            <Card.Body>
                                <Card.Title className="font-weight-bold">제품명</Card.Title>
                                <Card.Text>가격</Card.Text>
                            </Card.Body>
                        </Card>
kusang96's avatar
kusang96 committed
54
                        <Card className="mx-1 my-2" style={{ width: '18rem' }}>
55
                            <Card.Img className="img-fluid" variant="top" src="/icon/asd.jpg" />
56
57
58
59
60
                            <Card.Body>
                                <Card.Title className="font-weight-bold">제품명</Card.Title>
                                <Card.Text>가격</Card.Text>
                            </Card.Body>
                        </Card>
kusang96's avatar
kusang96 committed
61
                        <Card className="mx-1 my-2" style={{ width: '18rem' }}>
62
                            <Card.Img className="img-fluid" variant="top" src="/icon/asd.jpg" />
63
64
65
66
67
                            <Card.Body>
                                <Card.Title className="font-weight-bold">제품명</Card.Title>
                                <Card.Text>가격</Card.Text>
                            </Card.Body>
                        </Card>
kusang96's avatar
kusang96 committed
68
                        <Card className="mx-1 my-2" style={{ width: '18rem' }}>
69
                            <Card.Img className="img-fluid" variant="top" src="/icon/asd.jpg" />
70
71
72
73
74
75
76
                            <Card.Body>
                                <Card.Title className="font-weight-bold">제품명</Card.Title>
                                <Card.Text>가격</Card.Text>
                            </Card.Body>
                        </Card>
                    </Row>
                </div>
kusang96's avatar
kusang96 committed
77
                <div className="my-4">
kusang96's avatar
kusang96 committed
78
                    <h2 style={{ marginRight: "5rem", marginLeft: "3rem", marginBottom: "2rem", marginTop: "2rem" }}><u>New Arrival</u></h2>
kusang96's avatar
kusang96 committed
79
80
                    <Row className="justify-content-center mx-0">
                        <Card className="mx-1 my-2" style={{ width: '18rem' }}>
kusang96's avatar
kusang96 committed
81
                            <Card.Img className="img-fluid" variant="top" src="icon/asd.jpg" />
82
83
84
85
86
                            <Card.Body>
                                <Card.Title className="font-weight-bold">제품명</Card.Title>
                                <Card.Text>가격</Card.Text>
                            </Card.Body>
                        </Card>
kusang96's avatar
kusang96 committed
87
                        <Card className="mx-1 my-2" style={{ width: '18rem' }}>
kusang96's avatar
kusang96 committed
88
                            <Card.Img className="img-fluid" variant="top" src="icon/asd.jpg" />
89
90
91
92
93
                            <Card.Body>
                                <Card.Title className="font-weight-bold">제품명</Card.Title>
                                <Card.Text>가격</Card.Text>
                            </Card.Body>
                        </Card>
kusang96's avatar
kusang96 committed
94
                        <Card className="mx-1 my-2" style={{ width: '18rem' }}>
kusang96's avatar
kusang96 committed
95
                            <Card.Img className="img-fluid" variant="top" src="icon/asd.jpg" />
96
97
98
99
100
                            <Card.Body>
                                <Card.Title className="font-weight-bold">제품명</Card.Title>
                                <Card.Text>가격</Card.Text>
                            </Card.Body>
                        </Card>
kusang96's avatar
kusang96 committed
101
                        <Card className="mx-1 my-2" style={{ width: '18rem' }}>
kusang96's avatar
kusang96 committed
102
                            <Card.Img className="img-fluid" variant="top" src="icon/asd.jpg" />
103
104
105
106
107
                            <Card.Body>
                                <Card.Title className="font-weight-bold">제품명</Card.Title>
                                <Card.Text>가격</Card.Text>
                            </Card.Body>
                        </Card>
kusang96's avatar
kusang96 committed
108
                        <Card className="mx-1 my-2" style={{ width: '18rem' }}>
kusang96's avatar
kusang96 committed
109
                            <Card.Img className="img-fluid" variant="top" src="icon/asd.jpg" />
110
111
112
113
114
                            <Card.Body>
                                <Card.Title className="font-weight-bold">제품명</Card.Title>
                                <Card.Text>가격</Card.Text>
                            </Card.Body>
                        </Card>
kusang96's avatar
kusang96 committed
115
                        <Card className="mx-1 my-2" style={{ width: '18rem' }}>
kusang96's avatar
kusang96 committed
116
                            <Card.Img className="img-fluid" variant="top" src="icon/asd.jpg" />
117
118
119
120
121
122
123
124
                            <Card.Body>
                                <Card.Title className="font-weight-bold">제품명</Card.Title>
                                <Card.Text>가격</Card.Text>
                            </Card.Body>
                        </Card>
                    </Row>
                </div>
            </Container>
Kim, Subin's avatar
Kim, Subin committed
125
126
127
128
129
        </div>
    )
}

export default Home