'use client'
import LocationSearch from '@/components/LocationSearch';
import WeatherNow from '../components/WeatherNow'
import { useState } from 'react';
import { LocationType } from '@/types/types';


const [location, setLocation] = useState<LocationType | undefined>(undefined);
const { lat, lng } = location?.results[0].geometry.location;


export default function Home() {
  return (
    <main>
      <div className='block mx-auto max-w-4xl'>
        <LocationSearch setLocation={setLocation}/>
        <h1>The weather in {location?.results[0].address_components[0].long_name} for the next 3 days</h1>
        <WeatherNow location={location}/>
      </div>
    </main>
  );
}