ListCard.js 828 Bytes
Newer Older
이재연's avatar
0113    
이재연 committed
1
import React, { useState, useEffect, useRef } from 'react';
kusang96's avatar
kusang96 committed
2
import { Card, Button } from 'react-bootstrap';
이재연's avatar
0113    
이재연 committed
3

4
function ListCard({ id, name, price, main_img }) {
kusang96's avatar
kusang96 committed
5
6
7
8
9
10
    function handleDelete(e) {
        const card = e.target.parentNode.parentNode
        alert('해당 상품을 성공적으로 삭제하였습니다.')
        card.remove()
    }

이재연's avatar
0113    
이재연 committed
11
    return (
kusang96's avatar
kusang96 committed
12
        <Card id={id} className="m-3" style={{ width: "18rem" }}>
13
            <Card.Img variant="top" src={main_img && `/images/${main_img}`} style={{ objectFit: "contain", height: "22rem" }} />
이재연's avatar
0113    
이재연 committed
14
            <Card.Body>
15
16
                <Card.Title style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }}>{name}</Card.Title>
                <Card.Text>{price} </Card.Text>
이재연's avatar
0113    
이재연 committed
17
            </Card.Body>
18
        </Card>
이재연's avatar
0113    
이재연 committed
19
    )
kusang96's avatar
kusang96 committed
20
}
이재연's avatar
0113    
이재연 committed
21
22

export default ListCard