This commit is contained in:
2026-05-17 20:54:09 -04:00
parent 6da2183583
commit 74c21ee5cc
3000 changed files with 11794 additions and 15301 deletions

View File

@@ -0,0 +1,33 @@
@using Microsoft.EntityFrameworkCore
@using OpenArchival.DataAccess
@using MudBlazor
@namespace OpenArchival.Blazor.Blog
<MudPaper Class="pa-4 ma-2 rounded" Elevation="3" Style="overflow-x:auto">
<MudText Typo="Typo.h6">Latest Blog Posts</MudText>
<MudDivider/>
<MudStack Row="true" Spacing="4" Style="flex-wrap: nowrap;" Class="mt-4">
@foreach (BlogPost post in BlogPosts)
{
<div style="min-width: 300px;">
<BlogPostCard Post="post" Height="300"></BlogPostCard>
</div>
}
</MudStack>
</MudPaper>
@inject IDbContextFactory<ApplicationDbContext> ContextFactory;
@code {
private List<BlogPost> BlogPosts { get; set; } = [];
protected override async Task OnInitializedAsync()
{
await using var context = await ContextFactory.CreateDbContextAsync();
BlogPosts = await context.BlogPosts
.Include(p => p.MainPhoto)
.OrderByDescending(p => p.CreationTime)
.Take(10)
.ToListAsync();
}
}