Showing
5 changed files
with
49 additions
and
4 deletions
... | @@ -36,7 +36,6 @@ height: 100%; | ... | @@ -36,7 +36,6 @@ height: 100%; |
36 | <body class="pt-5" style="width : 100%; height:100%; margin: 0;"> | 36 | <body class="pt-5" style="width : 100%; height:100%; margin: 0;"> |
37 | <noscript>You need to enable JavaScript to run this app.</noscript> | 37 | <noscript>You need to enable JavaScript to run this app.</noscript> |
38 | <div id="root" style="width : 100%; height:100%;"></div> | 38 | <div id="root" style="width : 100%; height:100%;"></div> |
39 | - | ||
40 | <!-- | 39 | <!-- |
41 | This HTML file is a template. | 40 | This HTML file is a template. |
42 | If you open it directly in the browser, you will see an empty page. | 41 | If you open it directly in the browser, you will see an empty page. | ... | ... |
client/src/components/Map.js
0 → 100644
1 | +/*global kakao*/ | ||
2 | +import React, { useEffect } from 'react' | ||
3 | +import appKey from '../config/appKey.json'; | ||
4 | + | ||
5 | +const Map = (props) => { | ||
6 | + | ||
7 | + useEffect(()=>{ | ||
8 | + | ||
9 | + const script = document.createElement("script"); | ||
10 | + script.async = true; | ||
11 | + script.src = | ||
12 | + `https://dapi.kakao.com/v2/maps/sdk.js?appkey=${appKey.value}&autoload=false`; | ||
13 | + document.head.appendChild(script); | ||
14 | + | ||
15 | + script.onload = () => { | ||
16 | + kakao.maps.load(() => { | ||
17 | + let container = document.getElementById("myMap"); | ||
18 | + let options = { | ||
19 | + center: new kakao.maps.LatLng(props.latitude, props.longitude), | ||
20 | + level: 3 | ||
21 | + }; | ||
22 | + const map = new window.kakao.maps.Map(container, options); | ||
23 | + let markerPosition = new kakao.maps.LatLng(props.latitude, props.longitude); | ||
24 | + let marker = new kakao.maps.Marker({ | ||
25 | + position: markerPosition | ||
26 | + }); | ||
27 | + marker.setMap(map); | ||
28 | + }); | ||
29 | + }; | ||
30 | + | ||
31 | + } | ||
32 | + ); | ||
33 | + | ||
34 | + return ( | ||
35 | + <div id='myMap' style={{ | ||
36 | + 'width':'100%', | ||
37 | + 'height':'25rem' | ||
38 | + }}></div> | ||
39 | + ) | ||
40 | +} | ||
41 | + | ||
42 | +export default Map; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | import React, { useState } 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 { Modal, ModalHeader, ModalBody, ModalFooter, Container } from 'reactstrap'; |
4 | +import Map from './Map'; | ||
4 | import './MealCard.css'; | 5 | import './MealCard.css'; |
5 | import { faAngleRight } from "@fortawesome/free-solid-svg-icons" | 6 | import { faAngleRight } from "@fortawesome/free-solid-svg-icons" |
6 | import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" | 7 | import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" |
7 | 8 | ||
9 | + | ||
8 | const MealCard = (props) => { | 10 | const MealCard = (props) => { |
9 | 11 | ||
10 | const [modal, setModal] = useState(false); | 12 | const [modal, setModal] = useState(false); |
11 | - | ||
12 | const toggleModal = () => setModal(!modal); | 13 | const toggleModal = () => setModal(!modal); |
13 | 14 | ||
14 | return ( | 15 | return ( |
... | @@ -66,9 +67,12 @@ const MealCard = (props) => { | ... | @@ -66,9 +67,12 @@ const MealCard = (props) => { |
66 | <hr className="my-2"/> | 67 | <hr className="my-2"/> |
67 | {props.address} | 68 | {props.address} |
68 | <br/> | 69 | <br/> |
70 | + <Map | ||
71 | + latitude = {props.latitude} | ||
72 | + longitude = {props.longitude} | ||
73 | + /> | ||
69 | 74 | ||
70 | 75 | ||
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> | 76 | </ModalBody> |
73 | <ModalFooter> | 77 | <ModalFooter> |
74 | <div style={{ | 78 | <div style={{ | ... | ... |
... | @@ -51,7 +51,6 @@ const MenuPage = (props) => { | ... | @@ -51,7 +51,6 @@ const MenuPage = (props) => { |
51 | for(let k = 0; k < temp.length; k++) { | 51 | for(let k = 0; k < temp.length; k++) { |
52 | if(datas[j].type === temp[k]) { | 52 | if(datas[j].type === temp[k]) { |
53 | result.push(datas[j]); | 53 | result.push(datas[j]); |
54 | - console.log('skr'); | ||
55 | } | 54 | } |
56 | } | 55 | } |
57 | } | 56 | } | ... | ... |
-
Please register or login to post a comment