Download argon-dashboard-react/src/views/examples/Maps.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 3.5 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/argon-dashboard-react/src/views/examples/Maps.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/argon-dashboard-react/src/views/examples/Maps.js
-
curl -L -o Maps.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/argon-dashboard-react/src/views/examples/Maps.js
3.5 kB
| /*! | |
| ========================================================= | |
| * Argon Dashboard React - v1.2.4 | |
| ========================================================= | |
| * Product Page: https://www.creative-tim.com/product/argon-dashboard-react | |
| * Copyright 2024 Creative Tim (https://www.creative-tim.com) | |
| * Licensed under MIT (https://github.com/creativetimofficial/argon-dashboard-react/blob/master/LICENSE.md) | |
| * Coded by Creative Tim | |
| ========================================================= | |
| * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
| */ | |
| import React from "react"; | |
| // reactstrap components | |
| import { Card, Container, Row } from "reactstrap"; | |
| // core components | |
| import Header from "components/Headers/Header.js"; | |
| const MapWrapper = () => { | |
| const mapRef = React.useRef(null); | |
| React.useEffect(() => { | |
| let google = window.google; | |
| let map = mapRef.current; | |
| let lat = "40.748817"; | |
| let lng = "-73.985428"; | |
| const myLatlng = new google.maps.LatLng(lat, lng); | |
| const mapOptions = { | |
| zoom: 12, | |
| center: myLatlng, | |
| scrollwheel: false, | |
| zoomControl: true, | |
| styles: [ | |
| { | |
| featureType: "administrative", | |
| elementType: "labels.text.fill", | |
| stylers: [{ color: "#444444" }], | |
| }, | |
| { | |
| featureType: "landscape", | |
| elementType: "all", | |
| stylers: [{ color: "#f2f2f2" }], | |
| }, | |
| { | |
| featureType: "poi", | |
| elementType: "all", | |
| stylers: [{ visibility: "off" }], | |
| }, | |
| { | |
| featureType: "road", | |
| elementType: "all", | |
| stylers: [{ saturation: -100 }, { lightness: 45 }], | |
| }, | |
| { | |
| featureType: "road.highway", | |
| elementType: "all", | |
| stylers: [{ visibility: "simplified" }], | |
| }, | |
| { | |
| featureType: "road.arterial", | |
| elementType: "labels.icon", | |
| stylers: [{ visibility: "off" }], | |
| }, | |
| { | |
| featureType: "transit", | |
| elementType: "all", | |
| stylers: [{ visibility: "off" }], | |
| }, | |
| { | |
| featureType: "water", | |
| elementType: "all", | |
| stylers: [{ color: "#5e72e4" }, { visibility: "on" }], | |
| }, | |
| ], | |
| }; | |
| map = new google.maps.Map(map, mapOptions); | |
| const marker = new google.maps.Marker({ | |
| position: myLatlng, | |
| map: map, | |
| animation: google.maps.Animation.DROP, | |
| title: "Light Bootstrap Dashboard PRO React!", | |
| }); | |
| const contentString = | |
| '<div class="info-window-content"><h2>Light Bootstrap Dashboard PRO React</h2>' + | |
| "<p>A premium Admin for React-Bootstrap, Bootstrap, React, and React Hooks.</p></div>"; | |
| const infowindow = new google.maps.InfoWindow({ | |
| content: contentString, | |
| }); | |
| google.maps.event.addListener(marker, "click", function () { | |
| infowindow.open(map, marker); | |
| }); | |
| }, []); | |
| return ( | |
| <> | |
| <div | |
| style={{ height: `600px` }} | |
| className="map-canvas" | |
| id="map-canvas" | |
| ref={mapRef} | |
| ></div> | |
| </> | |
| ); | |
| }; | |
| const Maps = () => { | |
| return ( | |
| <> | |
| <Header /> | |
| {/* Page content */} | |
| <Container className="mt--7" fluid> | |
| <Row> | |
| <div className="col"> | |
| <Card className="shadow border-0"> | |
| <MapWrapper /> | |
| </Card> | |
| </div> | |
| </Row> | |
| </Container> | |
| </> | |
| ); | |
| }; | |
| export default Maps; | |