Place.js 1.51 KB
Newer Older
1
2
3
import axios from 'axios';
import React, { useEffect, useState } from 'react';
import { Modal, Container, Row, Col, Button, Badge, Card, Accordion, Carousel } from 'react-bootstrap';
Kim, Chaerin's avatar
Kim, Chaerin committed
4
5

function Place(props) {
6
7
8
9
  const [reviews, setReviews] = useState([])
  const getReview = () => {
    axios.get(`/api/review/${props.search.name}`)
      .then(res => {
Kim, Chaerin's avatar
Kim, Chaerin committed
10
        console.log("place res.data", res.data)
11
12
13
14
15
16
17
18
19
20
21
        setReviews(res.data)
      })
      .catch(err => {
        console.log(err)
      })
  }

  useEffect(() => {
    getReview();
  }, [])

Kim, Chaerin's avatar
Kim, Chaerin committed
22
  return (
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
    <Modal {...props}
      size="xl"
      keyboard="true"
      variant="backdrop.in"
      // show={lgShow}
      // onHide={() => setLgShow(false)}
      aria-labelledby="example-modal-sizes-title-lg">
      <Modal.Header closeButton>
        <Modal.Title id="contained-modal-title-vcenter" style={{ fontSize: '40px' }}>
          {props.index + 1}. {props.search.name}
        </Modal.Title>
      </Modal.Header>
      <Modal.Body className="show-grid">
        <Container style={{ fontSize: '40px' }}>
          {reviews.map((review, index) => {
            return (
              <Row className="mt-4">
                <a href={review.link}>{review.title}</a>
                <div>{review.summary}</div>
Kim, Chaerin's avatar
Kim, Chaerin committed
42
                <div>{review.content}</div>
43
44
45
              </Row>
            )
          })}
baesangjune's avatar
review    
baesangjune committed
46
        </Container>
47
48
49
50
51
52

      </Modal.Body>
      <Modal.Footer>
        <Button block onClick={props.onHide}>Close</Button>
      </Modal.Footer>
    </Modal>
Kim, Chaerin's avatar
Kim, Chaerin committed
53
54
55
  );
}

56
export default Place;