Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Domains/Frontend/MiniProjects/quickWeather/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# QuickWeather
Contributor:Utkarsh-660

## Description
QuickWeather is a simple weather card web app built using **HTML, CSS, and JavaScript**.
It uses the **OpenWeatherMap API** to display live **temperature**, **humidity**, and **wind speed** for any city you search.

## How to Run
1. Download or clone this repository to your computer.
2. Get your API key from [OpenWeatherMap](https://openweathermap.org/)
3. Open `script.js` and replace
```js
const apiKey = "YOUR_API_KEY";
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions Domains/Frontend/MiniProjects/quickWeather/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Weather App</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="card">
<div class="search">
<input type="text" placeholder="Enter city name" spellcheck="false">
<button > <img src="images/search.png" alt="" width="20px"></button>
</div>
<div class="weather">
<img src="images/clear.png" alt="" class="weatherimg">
<h1 class="temp">22°C</h1>
<h2 class="city">Kolkata</h2>
<div class="details">
<div class="col">
<div class="humidity-box">
<img src="images/humidity.png" alt="">
<div>
<p class="humidity">50%</p>
<p>Humidity</p>
</div>
</div>
<div class="Wind-Box">
<img src="images/wind.png" alt="">
<div>
<p class="wind">5.63km/h</p>
<p>Wind Speed</p>
</div>
</div>
</div>
</div>
</div>
</div>

</body>
<script src="script2.js"></script>
</html>
60 changes: 60 additions & 0 deletions Domains/Frontend/MiniProjects/quickWeather/script2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
const City=document.querySelector('.city');
const Temp=document.querySelector('.temp');
const Humidity=document.querySelector('.humidity');
const Wind=document.querySelector(".wind");
const Searchbox=document.querySelector('.search input')
const Searchbtn=document.querySelector('.search button')
const imagechange=document.querySelector('.weatherimg')


const apikey="a50203f62c5ba6a8f4b1dd5d3622cf41";
const apiUrl="https://api.openweathermap.org/data/2.5/weather?&units=metric&q=";


async function checkWeather(city){
const response=await fetch(apiUrl +city+`&appid=${apikey}`);
var data=await response.json();//it will contain all the data of the city
console.log(data);
City.innerHTML=data["name"];
Temp.innerHTML=Math.round(data.main["temp"]) + "°C";
Humidity.innerHTML=data.main["humidity"] +"%";
Wind.innerHTML=data.wind["speed"] +"Km/h";
const Weather=data.weather[0].main;
console.log(Weather);
switch (Weather) {
case "Clear":
imagechange.src="images/clear.png"
break;
case "Clouds":
imagechange.src="images/clouds.png"
break;
case "Drizzle":
imagechange.src="images/drizzle.png"
break;
case "Humidity":
imagechange.src="images/humidity.png"
break;
case "Mist":
imagechange.src="images/mist.png"
break;
case "Rain":
imagechange.src="images/rain.png"
break;
case "Snow":
imagechange.src="images/snow.png"
break;
case "Wind":
imagechange.src="images/wind.png"
break;


default:
break;
}

}
Searchbtn.addEventListener('click',()=>{
checkWeather(Searchbox.value);
})


82 changes: 82 additions & 0 deletions Domains/Frontend/MiniProjects/quickWeather/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
*{
margin: 0;
padding: 0;
box-sizing: border-box;


}
body{
background-color: #222;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
}
.card{
width:37vwvw;
background: linear-gradient(135deg,#00feba,#5b548a);
height:70vh;
color: #fff;
margin: 20px;
margin-top: 100px;
padding: 30px;
padding-top: 35px;
text-align: center;
border-radius: 20px;
}

.search{
width: 100%;
display: flex;
align-items: center;
gap: 20px;

}
.search input{
border: 0;
height: 60px;
color: grey;
padding: 10px 25px;

border-radius: 30px;
flex: 1;
font-size: 15px;
}
.search button{
border: 0;
border-radius: 50%;
width: 60px;
height: 60px;
cursor: pointer;

}
.search button img{
width: 16px;

}
.weatherimg{
width: 120px;
margin-top: 20px;
}
.temp{
font-size: 50px;
}
.city{
font-size: 50px;
}
.col{
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 20px;
}
.col img{
width: 40px;
margin-right: 10px;
}
.humidity{
font-size: 28px;
}
.wind{
font-size: 28px;
}
Loading