diff --git a/pages/index.js b/pages/index.js index 1d7b55f..f022a6a 100644 --- a/pages/index.js +++ b/pages/index.js @@ -4,13 +4,14 @@ import Image from "next/image"; export default function Home() { const [input, setInput] = useState("mumbai"); + const [systemUsed, setSystemUsed] = useState("metric"); const [weatherData, setWeatherData] = useState(); const clickHandler = async () => { const res = await fetch("/api/data", { method: "POST", headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ input }), + body: JSON.stringify({ input, systemUsed }), }); const data = await res.json(); console.log(data); @@ -55,6 +56,10 @@ export default function Home() { return time; }; + const changeSystem = () => { + console.log("system changed"); + }; + // console.log(convertTime(weatherData.dt, weatherData.timezone)); return ( @@ -64,6 +69,7 @@ export default function Home() {
{weatherData.weather[0].description}
@@ -78,22 +84,25 @@ export default function Home() { {Math.round(weatherData.main.temp)}°Feels like {Math.round(weatherData.main.feels_like)}°
- - {/*- Wind:{" "} - {` ${weatherData.wind.speed} ${degToCompass( - weatherData.wind.deg - )}`} -
-Sunrise
AM
- Sunrise:{" "} - {new Date( - weatherData.sys.sunrise * 1000 + weatherData.timezone * 1000 - ).toLocaleString("en-US")} -
*/} - {/*- Sunset:{" "} - {new Date(weatherData.sys.sunset * 1000).toLocaleString( - "en-US" - )} -
*/}Sunset
diff --git a/styles/Home.module.css b/styles/Home.module.css index be74dd8..72788ae 100644 --- a/styles/Home.module.css +++ b/styles/Home.module.css @@ -32,11 +32,16 @@ border-radius: 0 30px 30px 0; } +.titleAndSearch { + display: grid; + grid-template-columns: 2fr 1fr; + gap: 20px; +} + .statsBox { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; - border-radius: 20px; } @@ -58,13 +63,13 @@ .searchInput { margin-bottom: 20px; height: 40px; - width: 200px; - border: 2px solid rgb(230, 230, 230); + border: 2px solid rgb(34, 34, 34); + /* border: none; */ padding: 0 10px; - color: #c5c5c5; + color: #303030; font-size: 20px; text-align: right; - border-radius: 20px; + border-radius: 3px; font-family: "Varela Round", sans-serif; font-size: 18px; } diff --git a/styles/globals.css b/styles/globals.css index 114c4ef..5e95c53 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -17,6 +17,7 @@ body { ); font-family: "Varela Round", sans-serif; min-height: 100vh; + padding-top: 50px; } a {