From aa1e0e321ad64b72d80efcb7984acdf1cd3d6b7a Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Tue, 15 Nov 2022 12:20:30 +0700 Subject: refactor: Add some styling --- src/Pages/Index.cshtml | 14 ++++++++------ src/Pages/Index.cshtml.cs | 10 +++++----- src/Pages/Read.cshtml | 24 ++++++++++++++++-------- src/Pages/Shared/_Layout.cshtml | 9 +++++---- 4 files changed, 34 insertions(+), 23 deletions(-) (limited to 'src/Pages') diff --git a/src/Pages/Index.cshtml b/src/Pages/Index.cshtml index d7599bc..d809043 100644 --- a/src/Pages/Index.cshtml +++ b/src/Pages/Index.cshtml @@ -5,15 +5,17 @@ } @foreach (var article in Model.Source.Articles) { -
+
-

@Html.Raw(article.Title)

-
Kilde +

@Html.Raw(article.Title)

+ Les på nrk.no
}
- - @Model.Source.Attribution © @Model.Source.Name, @(DateTime.UtcNow.Subtract(Model.Source.Created).Minutes) minutter siden - +

+ + @Model.Source.Attribution © @Model.Source.Name, @(DateTime.UtcNow.Subtract(Model.Source.Created).Minutes) minutter siden + +

\ No newline at end of file diff --git a/src/Pages/Index.cshtml.cs b/src/Pages/Index.cshtml.cs index 9305766..80b0ed0 100644 --- a/src/Pages/Index.cshtml.cs +++ b/src/Pages/Index.cshtml.cs @@ -16,15 +16,15 @@ public class IndexModel : PageModel public NewsSource Source { get; set; } public async Task OnGet(string site) { - if (site.IsNullOrWhiteSpace()) { - return Redirect("/nrk"); - } - Source = site switch { "nrk" => await _grabber.GrabNrkAsync(), - _ => await _grabber.GrabNrkAsync() + _ => default }; + if (Source == default) { + return Redirect("/nrk"); + } + return Page(); } } \ No newline at end of file diff --git a/src/Pages/Read.cshtml b/src/Pages/Read.cshtml index 2aecc75..cbbd69a 100644 --- a/src/Pages/Read.cshtml +++ b/src/Pages/Read.cshtml @@ -4,23 +4,31 @@ ViewData["Title"] = Model.Source.Title; } -
+

@Model.Source.Title

@Model.Source.Subtitle

-
+
- Publisert: @Model.Source.PublishedAt.ToString("F")
- Oppdatert: @Model.Source.UpdatedAt.ToString("F") + @if (Model.Source.PublishedAt != default) { + Publisert: @Model.Source.PublishedAt.ToString("dd-MM-yyyy hh:mm:ss") + } + @if (Model.Source.UpdatedAt != default) { +
+ Oppdatert: @Model.Source.UpdatedAt.ToString("dd-MM-yyyy hh:mm:ss") + }
-
+
@foreach (var author in Model.Source.Authors) { - @author.Name: @author.Title
+ @author.Name: @author.Title +
}
-
-@Html.Raw(Model.Source.Content) \ No newline at end of file + +
+ @Html.Raw(Model.Source.Content) +
\ No newline at end of file diff --git a/src/Pages/Shared/_Layout.cshtml b/src/Pages/Shared/_Layout.cshtml index bcdd658..7831774 100644 --- a/src/Pages/Shared/_Layout.cshtml +++ b/src/Pages/Shared/_Layout.cshtml @@ -3,14 +3,15 @@ - - + + @ViewData["Title"] - Lettnytt
-
-- cgit v1.3