Commit a8218202 authored by Zach Knox's avatar Zach Knox

weather alerts

parent d6167b70
...@@ -30,6 +30,12 @@ ...@@ -30,6 +30,12 @@
color: #fff; color: #fff;
} }
.alert-card.mdl-card {
margin: auto;
width: auto;
background: #ee1111;
}
.forecast-grid.mdl-grid { .forecast-grid.mdl-grid {
} }
......
<template name="weather"> <template name="weather">
<div class="mdl-grid"> <div class="mdl-grid">
{{#if weatherData.alerts.title}}
<div class="mdl-cell mdl-cell--12-col">
<div class="alert-card weather-card mdl-card mdl-shadow--4dp">
<div class="mdl-card__title">
<h1 class="mdl-card__title-text"><a href="{{weatherData.alerts.url}}">{{weatherData.alerts.title}}</a> until {{formatTimestamp weatherData.alerts.expires}}<br /></h1>
</div>
<div class="mdl-card__supporting-text">
{{waatherData.alerts.description}}
</div>
</div>
</div>
{{/if}}
<div class="mdl-cell mdl-cell--12-col"> <div class="mdl-cell mdl-cell--12-col">
<div class="weather-card mdl-card mdl-shadow--4dp"> <div class="weather-card mdl-card mdl-shadow--4dp">
<div class="mdl-card__title"> <div class="mdl-card__title">
...@@ -13,7 +25,7 @@ ...@@ -13,7 +25,7 @@
</div> </div>
<div class="detail-size"> <div class="detail-size">
Feels like {{roundNumber weatherData.data.currently.apparentTemperature}}<i class="wi wi-fahrenheit"></i> Feels like {{roundNumber weatherData.data.currently.apparentTemperature}}<i class="wi wi-fahrenheit"></i>
<br /><br /><i class="wi wi-{{precipitationIcons}}"></i> {{precipitationWords}} &nbsp;&nbsp;&nbsp;<i class="wi wi-wind wi-towards-{{windDirectionClass}}"></i> {{roundNumber weatherData.data.currently.windSpeed}}mph {{windDirection}} <br /><br /><i class="wi wi-{{precipitationIcons weatherData.data.currently.precipProbability}}"></i> {{precipitationWords weatherData.data.currently.precipProbability}} &nbsp;&nbsp;&nbsp;<i class="wi wi-wind wi-towards-{{windDirectionClass}}"></i> {{roundNumber weatherData.data.currently.windSpeed}}mph {{windDirection}}
<!-- TODO: Change the icon based on time --> <!-- TODO: Change the icon based on time -->
<br /><br /><i class="wi wi-sunset"></i> {{formatTimestamp weatherData.data.currently.time}} <br /><br /><i class="wi wi-sunset"></i> {{formatTimestamp weatherData.data.currently.time}}
</div> </div>
......
...@@ -5,10 +5,9 @@ Template.weather.helpers({ ...@@ -5,10 +5,9 @@ Template.weather.helpers({
return weatherData; return weatherData;
}, },
//Convert precipitation percentage to words //Convert precipitation percentage to words
precipitationWords: function() { precipitationWords: function(precipProb) {
weatherDataDependency.depend(); weatherDataDependency.depend();
if(weatherData === undefined) return "..."; if(weatherData === undefined) return "...";
var precipProb = weatherData.data.currently.precipProbability;
if(precipProb === 0) return "No Rain Expected"; if(precipProb === 0) return "No Rain Expected";
if(precipProb > 50 && precipProb < 95) return "Potential for Rain"; if(precipProb > 50 && precipProb < 95) return "Potential for Rain";
if(precipProb > 95) return "Bring an Umbrella"; if(precipProb > 95) return "Bring an Umbrella";
...@@ -16,10 +15,9 @@ Template.weather.helpers({ ...@@ -16,10 +15,9 @@ Template.weather.helpers({
return precipProb+"% Precipitation"; // Otherwise, return the percentage return precipProb+"% Precipitation"; // Otherwise, return the percentage
}, },
//Convert precipitation percentage to icons //Convert precipitation percentage to icons
precipitationIcons: function() { precipitationIcons: function(precipProb) {
weatherDataDependency.depend(); weatherDataDependency.depend();
if(weatherData === undefined) return "..."; if(weatherData === undefined) return "...";
var precipProb = weatherData.data.currently.precipProbability;
if(precipProb === 0) return "cloud"; if(precipProb === 0) return "cloud";
if(precipProb > 50 && precipProb < 95) return "showers"; if(precipProb > 50 && precipProb < 95) return "showers";
if(precipProb > 95) return "umbrella"; if(precipProb > 95) return "umbrella";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment