diff --git a/client/src/App.js b/client/src/App.js index 9b7e7ab..54c93e2 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -1,26 +1,69 @@ -import {MapContainer, Marker, Popup, TileLayer} from 'react-leaflet' +import {useState} from "react" + +import {Icon} from 'leaflet' +import {Polyline, MapContainer, Marker, TileLayer} from 'react-leaflet' import './App.css'; -function Map() { +function Map({dep, arr}) { + const redIcon = new Icon({ + iconUrl: "https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-red.png", + iconSize: [25, 41], + iconAnchor: [12, 41], + popupAnchor: [1, -34], + shadowSize: [41, 41] + }) + const greenIcon = new Icon({ + iconUrl: "https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-green.png", + iconSize: [25, 41], + iconAnchor: [12, 41], + popupAnchor: [1, -34], + shadowSize: [41, 41] + }) return ( - - - - - A pretty CSS3 popup.
Easily customizable. -
-
+ + + + + ) } -function App() { +function AirportSearch({name, updateFun}) { + const [airports, setAirports] = useState([]) + + function autocomplete(event) { + const target = event.target + const value = target.value + fetch(`/api/airports?search=${value}`).then(resp => resp.json()).then(setAirports) + } + return <> - + + {airports.map(airport => <> + + )} + + + + +} + +function App() { + const [dep, setDep] = useState([0, 0]) + const [arr, setArr] = useState([0, 0]) + + return <> + + + }