import { useState } from 'react'; import PlacesAutocomplete from 'react-places-autocomplete'; const green = '#60f760'; const lightgrey = '#e0e0e0'; export default function Event({ title, group, location, time, }: { title: string; group: string; location: string; time: string; }) { const [needRideThere, setNeedRideThere] = useState(false); const [needRideBack, setNeedRideBack] = useState(false); const [rideThereLocation, setRideThereLocation] = useState(''); const [rideBackLocation, setRideBackLocation] = useState(''); return (

{title}

{group}
Time: {time}
Location: {location}
{ setNeedRideThere((needRideThere) => !needRideThere); }} > I need a ride there
{ setNeedRideBack((needRideBack) => !needRideBack); }} > I need a ride back
{needRideThere && ( <> setRideThereLocation(address)} value={rideThereLocation} > {({ getInputProps, getSuggestionItemProps, suggestions, loading, }) => (
{loading ? 'Loading' : suggestions.length > 0 && (
{suggestions.map((suggestion) => (
{suggestion.description}
))}
)}
)}
)} {needRideBack && ( <> setRideBackLocation(address)} value={rideBackLocation} > {({ getInputProps, getSuggestionItemProps, suggestions, loading, }) => (
{loading ? 'Loading' : suggestions.length > 0 && (
{suggestions.map((suggestion) => (
{suggestion.description}
))}
)}
)}
)}
); }