swa07016

MealCard Modal UI 구현

...@@ -30,7 +30,7 @@ height: 100%; ...@@ -30,7 +30,7 @@ height: 100%;
30 <title>MEALKHU</title> 30 <title>MEALKHU</title>
31 <link href="https://fonts.googleapis.com/css?family=Do+Hyeon:400" rel="stylesheet"> 31 <link href="https://fonts.googleapis.com/css?family=Do+Hyeon:400" rel="stylesheet">
32 <style> 32 <style>
33 - #root{font-family: 'Do Hyeon', sans-serif;} 33 + #root, .modalClass{font-family: 'Do Hyeon', sans-serif;}
34 </style> 34 </style>
35 </head> 35 </head>
36 <body class="pt-5" style="width : 100%; height:100%; margin: 0;"> 36 <body class="pt-5" style="width : 100%; height:100%; margin: 0;">
......
1 -import React from 'react'; 1 +import React, { useState } from 'react';
2 import { Card, CardBody, CardTitle, CardText, CardImg, CardFooter, Button } from 'reactstrap'; 2 import { Card, CardBody, CardTitle, CardText, CardImg, CardFooter, Button } from 'reactstrap';
3 +import { Modal, ModalHeader, ModalBody, ModalFooter, Container } from 'reactstrap';
3 import './MealCard.css'; 4 import './MealCard.css';
4 import { faAngleRight } from "@fortawesome/free-solid-svg-icons" 5 import { faAngleRight } from "@fortawesome/free-solid-svg-icons"
5 import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" 6 import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
6 7
7 const MealCard = (props) => { 8 const MealCard = (props) => {
9 +
10 + const [modal, setModal] = useState(false);
11 +
12 + const toggleModal = () => setModal(!modal);
13 +
8 return ( 14 return (
9 <> 15 <>
10 <Card style={{ 16 <Card style={{
...@@ -27,6 +33,7 @@ const MealCard = (props) => { ...@@ -27,6 +33,7 @@ const MealCard = (props) => {
27 }}> 33 }}>
28 34
29 <Button 35 <Button
36 + onClick={toggleModal}
30 className="button" 37 className="button"
31 style={{ 38 style={{
32 'width':'100%', 39 'width':'100%',
...@@ -50,6 +57,34 @@ const MealCard = (props) => { ...@@ -50,6 +57,34 @@ const MealCard = (props) => {
50 </Button> 57 </Button>
51 </CardFooter> 58 </CardFooter>
52 </Card> 59 </Card>
60 +
61 + <Modal size="lg" className="modalClass" isOpen={modal} toggle={toggleModal}>
62 + <ModalHeader toggle={toggleModal}>{props.name}</ModalHeader>
63 + <ModalBody>
64 +
65 + 주소
66 + <hr className="my-2"/>
67 + {props.address}
68 + <br/>
69 +
70 +
71 + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
72 + </ModalBody>
73 + <ModalFooter>
74 + <div style={{
75 + width:'100%',
76 + overflow:'hidden',
77 + wordWrap:'break-word'
78 + }}>
79 + <small>
80 + 썸네일 출처
81 + <hr className="my-2"/>
82 + {props.img_source}
83 + </small>
84 + </div>
85 + </ModalFooter>
86 + </Modal>
87 +
53 </> 88 </>
54 ); 89 );
55 }; 90 };
......
...@@ -24,6 +24,7 @@ const MenuPage = (props) => { ...@@ -24,6 +24,7 @@ const MenuPage = (props) => {
24 const [cafe, setCafe] = useState(false); 24 const [cafe, setCafe] = useState(false);
25 const [etc, setEtc] = useState(false); 25 const [etc, setEtc] = useState(false);
26 26
27 +
27 useEffect(() => { 28 useEffect(() => {
28 const fetchData = async () => { 29 const fetchData = async () => {
29 const result = await axios( 30 const result = await axios(
......