All checks were successful
Build blog docker image / Build-Blog-Image (push) Successful in 1m15s
Reviewed-on: #9
55 lines
1.2 KiB
Plaintext
55 lines
1.2 KiB
Plaintext
@page "/blog"
|
|
@using YaeBlog.Abstraction
|
|
@using YaeBlog.Models
|
|
|
|
@inject IEssayContentService Contents
|
|
@inject NavigationManager NavigationInstance
|
|
|
|
<PageTitle>
|
|
Ricardo's Blog
|
|
</PageTitle>
|
|
|
|
<div>
|
|
<div class="grid grid-cols-4">
|
|
<div class="col-span-4 md:col-span-3">
|
|
@foreach (BlogEssay essay in _essays)
|
|
{
|
|
<EssayCard Essay="@(essay)"/>
|
|
}
|
|
|
|
<Pagination BaseUrl="/blog/" Page="_page" PageCount="_pageCount"/>
|
|
</div>
|
|
|
|
<div class="col-span-4 md:col-span-1">
|
|
<BlogInformationCard/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
|
|
[SupplyParameterFromQuery] private int? Page { get; set; }
|
|
|
|
private readonly List<BlogEssay> _essays = [];
|
|
private const int EssaysPerPage = 8;
|
|
private int _pageCount = 1;
|
|
private int _page = 1;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
_page = Page ?? 1;
|
|
_pageCount = Contents.Count / EssaysPerPage + 1;
|
|
|
|
if (EssaysPerPage * _page > Contents.Count + EssaysPerPage)
|
|
{
|
|
NavigationInstance.NavigateTo("/NotFount");
|
|
return;
|
|
}
|
|
|
|
_essays.AddRange(Contents.Essays
|
|
.Skip((_page - 1) * EssaysPerPage)
|
|
.Take(EssaysPerPage));
|
|
}
|
|
|
|
}
|