Newsbot.Portal/Newsbot.Portal.Blazor.Server/Pages/Articles/Latest.razor

39 lines
1.2 KiB
Plaintext
Raw Normal View History

2023-06-15 21:53:24 -07:00
@page "/articles/latest"
@using Newsbot.Collector.Client
@using Newsbot.Collector.Client.Domain.Dto
2023-06-15 21:53:24 -07:00
<PageTitle>Latest</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">
2023-06-15 21:53:24 -07:00
<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;
}
}