lots of style updates, add details
This commit is contained in:
parent
3172fd9da7
commit
70c0fc6646
@ -1,21 +1,27 @@
|
||||
@model WeatherSet
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
ViewData["Title"] = $"{Model.Location.Name}, {Model.Location.Region} Weather";
|
||||
|
||||
var updateAge = (DateTime.Now - Model.Current.LastUpdated.Value).Minutes;
|
||||
}
|
||||
|
||||
<div class="location">
|
||||
@*<div>@Model.Location.Name, @Model.Location.Region</div>*@
|
||||
<small>Last updated @updateAge minutes ago</small>
|
||||
</div>
|
||||
|
||||
<div class="current-conditions">
|
||||
<div class="current-condition-name">@Model.Current.ConditionName</div>
|
||||
<div class="current-temperature">@Model.Current.Temperature<span class="degrees">°F</span></div>
|
||||
<div class="row current-conditions">
|
||||
<div class="col current-temperature">
|
||||
@Model.Current.Temperature<span class="degrees">°F</span>
|
||||
</div>
|
||||
<div class="col current-details">
|
||||
<div>@Model.Current.ConditionName</div>
|
||||
<div>Feels Like @Model.Current.FeelsLike</div>
|
||||
<div>Humidity @Model.Current.Humidity</div>
|
||||
<div>Winds @Model.Current.WindDirection / @Model.Current.WindSpeed</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detailed-conditions">
|
||||
<div class="forecast-details">
|
||||
|
||||
@foreach (var forecast in Model.Forecast)
|
||||
{
|
||||
@ -35,8 +41,12 @@
|
||||
})
|
||||
.ToList();
|
||||
|
||||
<div class="row day-name">
|
||||
<div class="col">@forecast.Date.FriendlyDate()</div>
|
||||
</div>
|
||||
|
||||
<div class="row day-summary">
|
||||
<div class="col col-6">@forecast.Summary.ConditionName</div>
|
||||
<div class="col col-6">@forecast.Summary.ConditionName </div>
|
||||
<div class="col col-6">@forecast.Summary.HighTemp / @forecast.Summary.LowTemp</div>
|
||||
</div>
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
@using WeatherDashboard
|
||||
@using WeatherDashboard.Web
|
||||
@using WeatherDashboard.Extensions
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
@ -20,7 +20,7 @@ html {
|
||||
body {
|
||||
font-family: 'Montserrat', sans-serif;
|
||||
color: #444;
|
||||
margin: 20px 10px;
|
||||
margin: 10px;
|
||||
background-color: floralwhite;
|
||||
}
|
||||
|
||||
@ -32,32 +32,59 @@ body {
|
||||
.degrees {
|
||||
font-size: 50px;
|
||||
position: absolute;
|
||||
margin: 20px 0 0 10px;
|
||||
margin: 10px 0 0 10px;
|
||||
opacity: .6;
|
||||
line-height: 50px;
|
||||
}
|
||||
|
||||
.current-conditions {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.current-temperature {
|
||||
font-size: 100px;
|
||||
font-weight: 500;
|
||||
line-height: 100px;
|
||||
}
|
||||
|
||||
.detailed-conditions {
|
||||
.current-details {
|
||||
text-align: right;
|
||||
font-size: 14px;
|
||||
margin-top: 10px;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.detailed-conditions .day-summary {
|
||||
font-size: 30px;
|
||||
.forecast-details {
|
||||
}
|
||||
|
||||
.forecast-details .day-name {
|
||||
font-size: 17px;
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.detailed-conditions .day-summary .col:last-of-type {
|
||||
.forecast-details .day-name:not(:first-of-type) {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.forecast-details .day-summary {
|
||||
font-size: 30px;
|
||||
line-height: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.forecast-details .day-summary .col:last-of-type {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.detailed-conditions .day-detail {
|
||||
.forecast-details .day-detail {
|
||||
font-size: 13px;
|
||||
opacity: 0.5;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.detailed-conditions .day-detail .col:last-of-type {
|
||||
|
||||
|
||||
.forecast-details .day-detail .col:last-of-type {
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ namespace WeatherDashboard
|
||||
{
|
||||
public class DayForecast
|
||||
{
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
[JsonProperty("day")]
|
||||
public ForecastSummary Summary { get; set; }
|
||||
|
||||
|
17
WeatherDashboard/Extensions/DateExtensions.cs
Normal file
17
WeatherDashboard/Extensions/DateExtensions.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace WeatherDashboard.Extensions
|
||||
{
|
||||
public static class DateExtensions
|
||||
{
|
||||
public static string FriendlyDate(this DateTime date)
|
||||
{
|
||||
var format = date.Year < DateTime.Now.Year
|
||||
? "dddd, M/d/yy"
|
||||
: "dddd, M/d";
|
||||
|
||||
return date.Date == DateTime.Now.Date ? "Today"
|
||||
: date.Date == DateTime.Now.AddDays(-1).Date ? "Yesterday"
|
||||
: date.Date == DateTime.Now.AddDays(1).Date ? "Tomorrow"
|
||||
: date.ToString(format);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user