Hacked Together simple desktop weather app

This commit is contained in:
Sean Corrigan 2020-07-29 17:01:17 -04:00
commit 0d4873cc8c
3 changed files with 2137 additions and 0 deletions

65
index.html Normal file
View File

@ -0,0 +1,65 @@
<!DOCTYPE html>
<head>
<title>WeatherXi</title>
<link rel="stylesheet" href="style.css">
<!--Angular-->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.8/angular.min.js"></script>
<!--END Angular-->
<script>
var lat = 43.2099824;
var lon = -79.9958742;
//This needs to be dynamic somehow
</script>
</head>
<body ng-app="mainPage" ng-controller="body">
<div class="container">
<div class="weather-side">
<div class="weather-gradient"></div>
<div class="date-container">
<h2 class="date-dayname">Today</h2><span class="date-day">DATE</span><span class="location">Ancaster</span>
</div>
<div class="weather-container"><i class="weather-icon" data-feather="sun"></i>
<h1 class="weather-temp">{{weather.current.temp}}&deg;C</h1>
<h3 class="weather-desc">{{weather.current.weather[0].main}}</h3>
</div>
</div>
<div class="info-side">
<div class="today-info-container">
<div class="today-info">
<div class="precipitation"> <span class="title">PRECIPITATION</span><span class="value">{{weather.minutely[0].precipitation}} %</span>
<div class="clear"></div>
</div>
<div class="humidity"> <span class="title">HUMIDITY</span><span class="value">{{weather.current.humidity}} %</span>
<div class="clear"></div>
</div>
<div class="wind"> <span class="title">WIND</span><span class="value">{{weather.current.wind_speed}} km/h</span>
<div class="clear"></div>
</div>
<div class="wind"> <span class="title">DIRECTION</span><span class="value">{{weather.current.wind_deg}} &deg;</span>
<div class="clear"></div>
</div>
</div>
</div>
<div class="week-container">
<ul class="week-list">
<li></i><span class="day-name">+1h</span><span class="day-temp">{{weather.hourly[0].temp}}&deg;C</span></li>
<li></i><span class="day-name">+2h</span><span class="day-temp">{{weather.hourly[1].temp}}&deg;C</span></li>
<li></i><span class="day-name">+4h</span><span class="day-temp">{{weather.hourly[3].temp}}&deg;C</span></li>
<li></i><span class="day-name">+8h</span><span class="day-temp">{{weather.hourly[7].temp}}&deg;C</span></li>
<div class="clear"></div>
</ul>
</div>
</div>
</div>
<script>
var app = angular.module('mainPage', []);
app.controller('body', function($scope, $http) {
//Some sort of async function so location is got before the script called
$http.get("https://api.openweathermap.org/data/2.5/onecall?lat=" + lat + "&lon=" + lon + "&units=metric&appid=5292f0a17ecbe4b523fe0609ed2c556f").then(function (response) {
$scope.weather = response.data;
});
});
</script>
</body>

1829
sample.json Normal file

File diff suppressed because it is too large Load Diff

243
style.css Normal file
View File

@ -0,0 +1,243 @@
@import url('https://fonts.googleapis.com/css?family=Montserrat:400,700,900&display=swap');
:root {
--gradient: linear-gradient( 135deg, #72EDF2 10%, #5151E5 100%);
}
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
line-height: 1.25em;
}
.clear {
clear: both;
}
body {
margin: 0;
width: 100%;
height: 100vh;
font-family: 'Montserrat', sans-serif;
background-color: #343d4b;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
.container {
border-radius: 25px;
-webkit-box-shadow: 0 0 70px -10px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 70px -10px rgba(0, 0, 0, 0.2);
background-color: #222831;
color: #ffffff;
height: 400px;
}
.weather-side {
position: relative;
height: 100%;
border-radius: 25px;
background-image: url("https://images.unsplash.com/photo-1559963110-71b394e7494d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80");
width: 300px;
-webkit-box-shadow: 0 0 20px -10px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 20px -10px rgba(0, 0, 0, 0.2);
-webkit-transition: -webkit-transform 300ms ease;
transition: -webkit-transform 300ms ease;
-o-transition: transform 300ms ease;
transition: transform 300ms ease;
transition: transform 300ms ease, -webkit-transform 300ms ease;
-webkit-transform: translateZ(0) scale(1.02) perspective(1000px);
transform: translateZ(0) scale(1.02) perspective(1000px);
float: left;
}
.weather-side:hover {
-webkit-transform: scale(1.1) perspective(1500px) rotateY(10deg);
transform: scale(1.1) perspective(1500px) rotateY(10deg);
}
.weather-gradient {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-image: var(--gradient);
border-radius: 25px;
opacity: 0.8;
}
.date-container {
position: absolute;
top: 25px;
left: 25px;
}
.date-dayname {
margin: 0;
}
.date-day {
display: block;
}
.location {
display: inline-block;
margin-top: 10px;
}
.location-icon {
display: inline-block;
height: 0.8em;
width: auto;
margin-right: 5px;
}
.weather-container {
position: absolute;
bottom: 25px;
left: 25px;
}
.weather-icon.feather {
height: 60px;
width: auto;
}
.weather-temp {
margin: 0;
font-weight: 700;
font-size: 4em;
}
.weather-desc {
margin: 0;
}
.info-side {
position: relative;
float: left;
height: 100%;
padding-top: 25px;
}
.today-info {
padding: 15px;
margin: 0 25px 25px 25px;
/* box-shadow: 0 0 50px -5px rgba(0, 0, 0, 0.25); */
border-radius: 10px;
}
.today-info>div:not(:last-child) {
margin: 0 0 10px 0;
}
.today-info>div .title {
float: left;
font-weight: 700;
}
.today-info>div .value {
float: right;
}
.week-list {
list-style-type: none;
padding: 0;
margin: 10px 35px;
-webkit-box-shadow: 0 0 50px -5px rgba(0, 0, 0, 0.25);
box-shadow: 0 0 50px -5px rgba(0, 0, 0, 0.25);
border-radius: 10px;
background: #
}
.week-list>li {
float: left;
padding: 15px;
cursor: pointer;
-webkit-transition: 200ms ease;
-o-transition: 200ms ease;
transition: 200ms ease;
border-radius: 10px;
}
.week-list>li:hover {
-webkit-transform: scale(1.1);
-ms-transform: scale(1.1);
transform: scale(1.1);
background: #fff;
color: #222831;
-webkit-box-shadow: 0 0 40px -5px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 40px -5px rgba(0, 0, 0, 0.2)
}
.week-list>li.active {
background: #fff;
color: #222831;
border-radius: 10px;
}
.week-list>li .day-name {
display: block;
margin: 10px 0 0 0;
text-align: center;
}
.week-list>li .day-icon {
display: block;
height: 30px;
width: auto;
margin: 0 auto;
}
.week-list>li .day-temp {
display: block;
text-align: center;
margin: 10px 0 0 0;
font-weight: 700;
}
.location-container {
padding: 25px 35px;
}
.location-button {
outline: none;
width: 100%;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border: none;
border-radius: 25px;
padding: 10px;
font-family: 'Montserrat', sans-serif;
background-image: var(--gradient);
color: #ffffff;
font-weight: 700;
-webkit-box-shadow: 0 0 30px -5px rgba(0, 0, 0, 0.25);
box-shadow: 0 0 30px -5px rgba(0, 0, 0, 0.25);
cursor: pointer;
-webkit-transition: -webkit-transform 200ms ease;
transition: -webkit-transform 200ms ease;
-o-transition: transform 200ms ease;
transition: transform 200ms ease;
transition: transform 200ms ease, -webkit-transform 200ms ease;
}
.location-button:hover {
-webkit-transform: scale(0.95);
-ms-transform: scale(0.95);
transform: scale(0.95);
}
.location-button .feather {
height: 1em;
width: auto;
margin-right: 5px;
}