add stats card
@ -4,6 +4,7 @@ import Image from "next/image";
|
||||
|
||||
export default function Home() {
|
||||
const [input, setInput] = useState();
|
||||
const [defaultValue, setDefaultValue] = useState("Search a city...");
|
||||
const [isCurrentActive, setIsCurrentActive] = useState(true);
|
||||
const [weatherData, setWeatherData] = useState();
|
||||
|
||||
@ -16,7 +17,9 @@ export default function Home() {
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
setWeatherData({ ...data });
|
||||
|
||||
setInput("");
|
||||
// setDefaultValue("sss");
|
||||
};
|
||||
|
||||
const something = (event) => {
|
||||
@ -69,43 +72,59 @@ export default function Home() {
|
||||
{Math.round(weatherData.main.temp)}°
|
||||
</h1>
|
||||
<p>Feels like {Math.round(weatherData.main.feels_like)}°</p>
|
||||
<p>Humidity: {weatherData.main.humidity}</p>
|
||||
<p>
|
||||
Wind:{" "}
|
||||
{`${weatherData.wind.speed} to ${
|
||||
weatherData.wind.gust
|
||||
} ${degToCompass(weatherData.wind.deg)}`}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Time:{" "}
|
||||
{new Date(
|
||||
weatherData.dt * 1000 + weatherData.timezone * 1000
|
||||
).toLocaleString("en-US")}
|
||||
</p>
|
||||
<p>Sunrise: {weatherData.sys.sunrise}</p>
|
||||
<p>Sunstet: {weatherData.sys.sunset}</p>
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.statsWrapper}>
|
||||
<h1>Stats info</h1>
|
||||
<div className={styles.statsBox}>
|
||||
<div>Stats card1</div>
|
||||
<div>Stats card2</div>
|
||||
<div>Stats card3</div>
|
||||
<div>Stats card4</div>
|
||||
<div>Stats card5</div>
|
||||
<div>Stats card6</div>
|
||||
</div>
|
||||
</div>
|
||||
<input
|
||||
type="text"
|
||||
className={styles.searchInput}
|
||||
defaultValue="Search a cities..."
|
||||
defaultValue={defaultValue}
|
||||
placeholder="🔍 Search a city ..."
|
||||
value={input}
|
||||
onFocus={(e) => (e.target.value = "")}
|
||||
onChange={(e) => setInput(e.target.value)}
|
||||
onKeyDown={(e) => something(e)}
|
||||
/>
|
||||
{weatherData && (
|
||||
<div className={styles.statsBox}>
|
||||
<div>Stats card1</div>
|
||||
<div>Stats card2</div>
|
||||
<div>Visibility: {weatherData.visibility / 1000} km</div>
|
||||
<div>
|
||||
<p>Humidity: {weatherData.main.humidity}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>
|
||||
Wind:{" "}
|
||||
{` ${weatherData.wind.speed} ${degToCompass(
|
||||
weatherData.wind.deg
|
||||
)}`}
|
||||
</p>
|
||||
</div>
|
||||
<div style={{ padding: "20px", border: "1px solid grey" }}>
|
||||
<p>
|
||||
Sunrise:{" "}
|
||||
{new Date(
|
||||
weatherData.sys.sunrise * 1000 + weatherData.timezone * 1000
|
||||
).toLocaleString("en-US")}
|
||||
</p>
|
||||
<p>
|
||||
Sunset:{" "}
|
||||
{new Date(weatherData.sys.sunset * 1000).toLocaleString(
|
||||
"en-US"
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
BIN
public/icons/png/001-cloudy.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
public/icons/png/002-rain.png
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
public/icons/png/003-cloud.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
public/icons/png/004-storm.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
public/icons/png/005-flash.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
public/icons/png/006-snow.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
public/icons/png/007-drops.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
public/icons/png/008-moon.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
public/icons/png/009-cloudy.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
public/icons/png/010-moon.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
public/icons/png/011-umbrella.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
public/icons/png/012-moonset.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
public/icons/png/013-snow.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
public/icons/png/014-Hailstorm.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
public/icons/png/015-snow.png
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
public/icons/png/016-snow.png
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
public/icons/png/017-wind.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
public/icons/png/018-thermometer.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
public/icons/png/019-thermometer.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
public/icons/png/020-thermometer.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
public/icons/png/021-thermometer.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
public/icons/png/022-sun.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
public/icons/png/023-thermometer.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
public/icons/png/024-thermometer.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
public/icons/png/025-cloudy.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
public/icons/png/026-flood.png
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
public/icons/png/027-thermometer.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
public/icons/png/028-snowfall.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
public/icons/png/029-icicles.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
public/icons/png/030-wave.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
public/icons/png/031-co2.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
public/icons/png/032-hurricane.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
public/icons/png/033-sun.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
public/icons/png/034-wind.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
public/icons/png/035-tornado.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
public/icons/png/036-snowflake.png
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
public/icons/png/037-iceberg.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
public/icons/png/038-fog.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
public/icons/png/039-rainbow.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
public/icons/png/040-rainbow.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
public/icons/png/041-wind sign.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
public/icons/png/042-rain.png
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
public/icons/png/043-sun.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
public/icons/png/044-cloud.png
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
public/icons/png/045-eclipse.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
public/icons/png/046-sunny.png
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
public/icons/png/047-cloud.png
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
public/icons/png/048-sunset.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
public/icons/png/049-rain.png
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
public/icons/png/050-fog.png
Normal file
After Width: | Height: | Size: 24 KiB |
@ -8,7 +8,7 @@
|
||||
backdrop-filter: blur(3px);
|
||||
-webkit-backdrop-filter: blur(3px);
|
||||
border-radius: 30px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.18);
|
||||
/* border: 1px solid rgba(255, 255, 255, 0.18); */
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 2fr;
|
||||
}
|
||||
@ -30,14 +30,20 @@
|
||||
.statsWrapper {
|
||||
background-color: rgb(247, 247, 247);
|
||||
padding: 30px;
|
||||
text-align: right;
|
||||
border-radius: 0 30px 30px 0;
|
||||
}
|
||||
|
||||
.statsBox {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
gap: 20px;
|
||||
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.statsCard {
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
}
|
||||
|
||||
.mainTemp {
|
||||
@ -45,12 +51,17 @@
|
||||
}
|
||||
|
||||
.searchInput {
|
||||
margin-top: 200px;
|
||||
margin-bottom: 20px;
|
||||
height: 40px;
|
||||
width: 300px;
|
||||
border: none;
|
||||
padding: 0 10px;
|
||||
color: #242424;
|
||||
color: #c5c5c5;
|
||||
/* background-color: none; */
|
||||
font-size: 20px;
|
||||
background: rgba(255, 255, 255, 0.25);
|
||||
text-align: right;
|
||||
/* background-color: rgb(247, 247, 247); */
|
||||
border-radius: 20px;
|
||||
font-family: "Varela Round", sans-serif;
|
||||
font-size: 18px;
|
||||
}
|
||||
|