Newsbot.Portal/Newsbot.Portal.Blazor.Server/Pages/Articles/Latest.razor
James Tombleson 8d3a5e574d
All checks were successful
continuous-integration/drone/pr Build is passing
Updated page title
2023-06-15 22:26:39 -07:00

39 lines
1.2 KiB
Plaintext

@page "/articles/latest"
@using Newsbot.Collector.Client
@using Newsbot.Collector.Client.Domain.Dto
<PageTitle>Latest Posts</PageTitle>
<h3>Latest Posts</h3>
<div class="container">
<div class="row">
@foreach (var item in Data ??= new List<ArticlesDto>())
{
<div class="col-sm">
<div class="card" style="width: 18rem;">
<img src="@item.Thumbnail" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">
<a href="@item.Url" target="_blank">@item.Title</a>
</h5>
<p class="card-text">@item.PubDate</p>
<p class="card-text">@item.Description</p>
<a href="@item.Url" class="btn btn-primary" target="_blank">View</a>
</div>
</div>
</div>
}
</div>
</div>
@code {
List<ArticlesDto>? Data { get; set; }
protected override async Task OnInitializedAsync()
{
var c = new ArticlesClient(Global.HttpClient, Global.DefaultInstanceUri ?? "");
var items = await c.ListArticlesAsync();
Data = items;
}
}