diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-11-15 06:20:30 +0100 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-11-15 06:20:30 +0100 |
| commit | aa1e0e321ad64b72d80efcb7984acdf1cd3d6b7a (patch) | |
| tree | 4abce617ce12dea1ebe9f030d93ebb5f4407cad8 /src/Pages | |
| parent | add94527050dc311c4ad117e25dd5e4517b3b887 (diff) | |
| download | lettnytt-aa1e0e321ad64b72d80efcb7984acdf1cd3d6b7a.tar.xz lettnytt-aa1e0e321ad64b72d80efcb7984acdf1cd3d6b7a.zip | |
refactor: Add some styling
Diffstat (limited to 'src/Pages')
| -rw-r--r-- | src/Pages/Index.cshtml | 14 | ||||
| -rw-r--r-- | src/Pages/Index.cshtml.cs | 10 | ||||
| -rw-r--r-- | src/Pages/Read.cshtml | 24 | ||||
| -rw-r--r-- | src/Pages/Shared/_Layout.cshtml | 9 |
4 files changed, 34 insertions, 23 deletions
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) { - <section> + <section style="margin-bottom: 8px;display: flex; flex-direction: column"> <a href="/les/@Model.Source.Name?url=@article.Href"> - <h2>@Html.Raw(article.Title)</h2> - <a href="@article.Href" rel="noreferrer">Kilde</a> + <h2 style="font-size: 18px">@Html.Raw(article.Title)</h2> </a> + <a href="@article.Href" style="font-size: 14px;display:flex;justify-content: end" rel="noreferrer">Les på nrk.no</a> </section> } <footer> - <small> - @Model.Source.Attribution © @Model.Source.Name, @(DateTime.UtcNow.Subtract(Model.Source.Created).Minutes) minutter siden - </small> + <p> + <small> + @Model.Source.Attribution © @Model.Source.Name, @(DateTime.UtcNow.Subtract(Model.Source.Created).Minutes) minutter siden + </small> + </p> </footer>
\ 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<ActionResult> 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; } -<div style="display: flex; justify-content: space-between"> +<div id="art-header" style="display: flex; justify-content: space-between"> <div> <h1>@Model.Source.Title</h1> <p>@Model.Source.Subtitle</p> </div> - <div style="display: flex; flex-direction: row"> + <div style="display: flex; flex-direction: column; flex-wrap: nowrap"> <div style="flex-direction:column"> - <small>Publisert: @Model.Source.PublishedAt.ToString("F")</small><br> - <small>Oppdatert: @Model.Source.UpdatedAt.ToString("F")</small> + @if (Model.Source.PublishedAt != default) { + <small style="white-space: nowrap">Publisert: @Model.Source.PublishedAt.ToString("dd-MM-yyyy hh:mm:ss")</small> + } + @if (Model.Source.UpdatedAt != default) { + <br/> + <small style="white-space: nowrap">Oppdatert: @Model.Source.UpdatedAt.ToString("dd-MM-yyyy hh:mm:ss")</small> + } </div> - <div style="margin: 0 5px; height: 100%; border: 1px solid black"></div> + <div style="margin: 0 5px; border: 0.5px solid black"></div> <div style="flex-direction:column"> @foreach (var author in Model.Source.Authors) { - <small><em>@author.Name</em>: @author.Title</small> <br/> + <small style="white-space: nowrap"><b>@author.Name</b>: @author.Title</small> + <br/> } </div> </div> </div> -<hr> -@Html.Raw(Model.Source.Content)
\ No newline at end of file + +<div id="art-body"> + @Html.Raw(Model.Source.Content) +</div>
\ 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 @@ <head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> - <link rel="stylesheet" href="/reset.css" > - <link rel="stylesheet" href="/index.css" > + <link rel="stylesheet" href="/reset.css"> + <link rel="stylesheet" href="/index.css"> <title>@ViewData["Title"] - Lettnytt</title> </head> <body> <header> - <nav> - <a href="/nrk">NRK</a> + <nav style="display: flex; flex-direction: row; gap: 0 15px"> + <a href="/nrk" style="color: @(Path.StartsWith("/nrk") ? "black" : "blue")">NRK</a> + <a href="/dagbladet" style="color: @(Path.StartsWith("/dagbladet") ? "black" : "blue")">Dagbladet</a> </nav> </header> <main> |
