diff --git a/coffee_and_coding/app/components/GoogleMap.jsx b/coffee_and_coding/app/components/GoogleMap.jsx index e69bfd3c..09188e4b 100644 --- a/coffee_and_coding/app/components/GoogleMap.jsx +++ b/coffee_and_coding/app/components/GoogleMap.jsx @@ -1,26 +1,18 @@ import React from "react"; import PropTypes from "prop-types"; -import { GoogleMap, Marker, LoadScript } from "@react-google-maps/api"; -const MapContainer = ({ searchValue }) => { +export const GoogleMap = ({ searchValue }) => { const defaultCenter = { lat: 40.7128, lng: -74.006 }; // Default center coordinates return ( - - - {/* Marker component */} - - - + ); }; -MapContainer.propTypes = { - searchValue: PropTypes.string.isRequired, -}; - -export default MapContainer; +// MapContainer.propTypes = { +// searchValue: PropTypes.string.isRequired, +// }; diff --git a/coffee_and_coding/app/components/MapContainer.jsx b/coffee_and_coding/app/components/MapContainer.jsx index 6bad7cb7..ea64a7c5 100644 --- a/coffee_and_coding/app/components/MapContainer.jsx +++ b/coffee_and_coding/app/components/MapContainer.jsx @@ -1,57 +1,64 @@ "use client"; -import React, { useState } from 'react'; -import PropTypes from 'prop-types'; -import { GoogleMap, useLoadScript, Marker } from '@react-google-maps/api'; -import Grid from '@mui/material/Grid'; -import { Box } from '@mui/material'; -const libraries = ['places']; +import React, { useState } from "react"; +import PropTypes from "prop-types"; +import { GoogleMap, useLoadScript, Marker } from "@react-google-maps/api"; +import Grid from "@mui/material/Grid"; +import { Box } from "@mui/material"; +const libraries = ["places"]; const mapContainerStyle = { - height: '75vh', + height: "100vh", }; -const coffeeMarkers = [ - { lat: 37.7749, lng: -122.4194 }, // San Francisco, CA - { lat: 40.7128, lng: -74.0060 }, // New York City, NY - { lat: 34.0522, lng: -118.2437 }, // Los Angeles, CA -]; -export const MapContainer = ({ searchValue }) => { +export const MapContainer = ({ + searchValue, + coffeeMarkers, + handlePlaceClicked, +}) => { + const [selectedMarker, setSelectedMarker] = useState(""); + const handleMarkerClick = (event, place) => { + console.log(place); + handlePlaceClicked(place); + }; + const { isLoaded, loadError } = useLoadScript({ + googleMapsApiKey: process.env.NEXT_PUBLIC_API_Key, + libraries, + }); - const [selectedMarker, setSelectedMarker] = useState(""); - const handleMarkerClick = () => { - console.log("CLICKED"); - } - const { isLoaded, loadError } = useLoadScript({ - googleMapsApiKey: process.env.NEXT_PUBLIC_API_Key, - libraries, - }); + if (loadError) { + return
Error loading maps
; + } - if (loadError) { - return
Error loading maps
; - } + if (!isLoaded) { + return
Loading maps
; + } - if (!isLoaded) { - return
Loading maps
; - } - - return ( -
- - - {coffeeMarkers.map((place, index) => ( - handleMarkerClick(event, place)} - /> - ))} - - - -
- ); -} + return ( +
+ + + {coffeeMarkers.map((place, index) => ( + handleMarkerClick(event, place)} + /> + ))} + + + +
+ ); +}; // MapContainer.propTypes = { // searchValue: PropTypes.string.isRequired, -// }; \ No newline at end of file +// }; diff --git a/coffee_and_coding/app/components/PopUp.jsx b/coffee_and_coding/app/components/PopUp.jsx index 538d4df9..1edf6298 100644 --- a/coffee_and_coding/app/components/PopUp.jsx +++ b/coffee_and_coding/app/components/PopUp.jsx @@ -1,18 +1,26 @@ "use client"; -import React, { useState } from 'react'; -import Box from '@mui/material/Box'; -import Switch from '@mui/material/Switch'; -import Paper from '@mui/material/Paper'; -import Slide from '@mui/material/Slide'; -import FormControlLabel from '@mui/material/FormControlLabel'; -import {sizing} from '@mui/system'; +import React, { useState } from "react"; +import Paper from "@mui/material/Paper"; +import { Typography } from "@mui/material"; +import { styled } from "@mui/material/styles"; -export const PopUp = ({place}) => { - return ( -
- +const PaperStyling = styled(Paper)(({ theme }) => ({ + width: "100%", + padding: theme.spacing(4), + ...theme.typography.body2, + textAlign: "center", +})); - -
- ) -} \ No newline at end of file +export const PopUp = ({ place }) => { + return ( + + + + CAFE COMMA + + Ratings... + {place.lat} + + + ); +}; diff --git a/coffee_and_coding/app/page.jsx b/coffee_and_coding/app/page.jsx index 547cd3f4..784a457a 100644 --- a/coffee_and_coding/app/page.jsx +++ b/coffee_and_coding/app/page.jsx @@ -1,75 +1,99 @@ "use client"; -import React, { useState } from 'react'; -import Image from 'next/image'; -import Grid from '@mui/material/Grid'; -import Box from '@mui/material/Box'; -import { Search } from './components/Search.jsx'; -import { MapContainer } from './components/MapContainer.jsx'; -import { PopUp } from './components/PopUp.jsx'; +import React, { useState } from "react"; +import Image from "next/image"; +import Grid from "@mui/material/Grid"; +import Box from "@mui/material/Box"; +import { Search } from "./components/Search.jsx"; +import { GoogleMap } from "./components/GoogleMap.jsx"; +import { PopUp } from "./components/PopUp.jsx"; +import FormControlLabel from "@mui/material/FormControlLabel"; +import Switch from "@mui/material/Switch"; +import Fade from "@mui/material/Fade"; +import { MapContainer } from "./components/MapContainer.jsx"; + +const coffeeMarkers = [ + { lat: 37.7749, lng: -122.4194 }, // San Francisco, CA + { lat: 40.7128, lng: -74.006 }, // New York City, NY + { lat: 34.0522, lng: -118.2437 }, // Los Angeles, CA +]; export default function Home() { - const [searchValue, setSearchValue] = useState("Atlanta, GA"); - const [placeClicked, placeClickedValue] = useState("Atlanta, GA"); + const [searchValue, setSearchValue] = useState("Atlanta, GA"); + const [placeClicked, setPlaceClicked] = useState("Atlanta, GA"); + + const handlePlaceClicked = (place) => { + setPlaceClicked(place); + }; + + const handleEnterPress = (inputValue) => { + // console.log(inputValue); + setSearchValue(inputValue); + }; + const [checked, setChecked] = useState(false); - const handleEnterPress = (inputValue) => { - console.log(inputValue); - setSearchValue(inputValue); - }; + const handleChange = () => { + setChecked((prev) => !prev); + }; - // const handlePlaceClicker = () - - return ( -
-
-

- Coffee and Coding - -

-
- - By{" "} - {/* Vercel Logo */} - -
-
+ return ( +
+
+

+ Coffee and Coding + +

+
-
- {/* Next.js Logo */} -
- - - - - - - - - - - - - - - -
- ); + + + + + + + + + + } + label="Show from target" + /> + + + + + + + +
+ +
+
+
+
+
+
+
+ ); }