MovieChart.js 2.39 KB
Newer Older
Jiwon Yoon's avatar
Jiwon Yoon committed
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import React, { useState, useEffect } from 'react'
import styles from "./movieChart.module.scss"
const MovieChart = () => {
    const MovieChartList = [
        {
            "id":1,
            "src": "/images/movie_image_black.jpg",
            "title": "블랙위도우",
            "popularity": 50.98,
            "release_date": "2021-07-07",
            "runtime": 134
        },
        {
            "id":2,
            "src": "/images/movie_image_limit.jpg",
            "title": "발신제한",
            "popularity": 3.22,
            "release_date": "2021-06-23",
            "runtime": 94
        },
        {
            "id":3,
            "src": "/images/movie_image_everyday.jpg",
            "title": "우리는 매일매일",
            "popularity": 2.83,
            "release_date": "2021-06-30",
            "runtime": 75
        },
        {
            "id":4,
            "src": "/images/movie_image_cruella.jpg",
            "title": "크루엘라",
            "popularity": 1.72,
            "release_date": "2021-05-26",
            "runtime": 133
        }
    ]
    return (
        <div class="row row-cols-1 row-cols-md-4 g-4">
            {MovieChartList.length > 0
                ?
                MovieChartList.map(movie => (
                    <div className="card h-100" style={{ backgroundColor: "black" }}>
                        <a href={`/movie/${movie.id}`}>
                            <img src={movie.src} className={`card-img-top rounded ${styles.poster}`} alt="Movie Poster" />
                            {/* <div className={`${styles.darkness}`}></div> */}
                            {/* <div className={`${styles.description}`}>상세설명asdasd</div> */}
                        </a>
                        <div className="card-body text-light">
                            <h5 className="card-title text-center">{movie.title}</h5>
                            <p className="card-text text-center">예매율: {movie.popularity}% | {movie.runtime}</p>
                            <p className="card-text text-center"><small className="text-muted">{movie.release_date} 개봉</small></p>
                        </div>
                        <button className="btn btn-warning">예매하기</button>
                    </div>
                ))
                : <div>영화정보를 로딩할  없습니다.</div>
            }
        </div>
    )
}

export default MovieChart