Added ArticleTileArray

This commit is contained in:
Mia Rose Winter 2024-01-25 16:45:54 +01:00
parent 4af471b48a
commit 1601e80dfb
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E
5 changed files with 21 additions and 12 deletions

View file

@ -0,0 +1,10 @@
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-x-8 gap-y-4 mb-6" @attributes="AdditionalAttributes">
@ChildContent
</div>
@code {
[Parameter]
public required RenderFragment ChildContent { get; set; }
[Parameter(CaptureUnmatchedValues = true)]
public IDictionary<string, object>? AdditionalAttributes { get; set; }
}

View file

@ -8,14 +8,14 @@
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject IStringLocalizer<Drafts> Localizer @inject IStringLocalizer<Drafts> Localizer
<div class="flex gap-x-8 gap-y-4"> <ArticleTileArray>
@foreach (var article in Articles) { @foreach (var article in Articles) {
<ArticleTile Article="article" /> <ArticleTile Article="article" />
} }
@if (Articles.Count < 1) { @if (Articles.Count < 1) {
<p>@Localizer["NoArticles"]</p> <p>@Localizer["NoArticles"]</p>
} }
</div> </ArticleTileArray>
@code { @code {
[CascadingParameter] [CascadingParameter]

View file

@ -1,20 +1,19 @@
@page "/future" @page "/future"
@using Wave.Data @using Wave.Data
@using Microsoft.EntityFrameworkCore @using Microsoft.EntityFrameworkCore
@using Wave.Data.Migrations.postgres
@attribute [Authorize(Policy = "ArticleDeletePermissions")] @attribute [Authorize(Policy = "ArticleDeletePermissions")]
@inject IDbContextFactory<ApplicationDbContext> ContextFactory @inject IDbContextFactory<ApplicationDbContext> ContextFactory
@inject IStringLocalizer<Future> Localizer @inject IStringLocalizer<Future> Localizer
<div class="flex gap-x-8 gap-y-4"> <ArticleTileArray>
@foreach (var article in Articles) { @foreach (var article in Articles) {
<ArticleTile Article="article" /> <ArticleTile Article="article" />
} }
@if(Articles.Count < 1) { @if(Articles.Count < 1) {
<p>@Localizer["NoArticles"]</p> <p>@Localizer["NoArticles"]</p>
} }
</div> </ArticleTileArray>
@code { @code {
private List<Article> Articles { get; } = []; private List<Article> Articles { get; } = [];

View file

@ -45,11 +45,11 @@
<p>@Localizer["NoArticles_Message"]</p> <p>@Localizer["NoArticles_Message"]</p>
} }
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-x-8 gap-y-4 mb-6"> <ArticleTileArray>
@foreach (var article in Articles.Skip(1)) { @foreach (var article in Articles.Skip(1)) {
<ArticleTile Article="article" /> <ArticleTile Article="article" />
} }
</div> </ArticleTileArray>
} }
@if (HasMore) { @if (HasMore) {

View file

@ -6,14 +6,14 @@
@inject IDbContextFactory<ApplicationDbContext> ContextFactory @inject IDbContextFactory<ApplicationDbContext> ContextFactory
@inject IStringLocalizer<Review> Localizer @inject IStringLocalizer<Review> Localizer
<div class="flex gap-x-8 gap-y-4"> <ArticleTileArray>
@foreach (var article in Articles) { @foreach (var article in Articles) {
<ArticleTile Article="article" /> <ArticleTile Article="article" />
} }
@if(Articles.Count < 1) { @if(Articles.Count < 1) {
<p>@Localizer["NoArticles"]</p> <p>@Localizer["NoArticles"]</p>
} }
</div> </ArticleTileArray>
@code { @code {
private List<Article> Articles { get; } = []; private List<Article> Articles { get; } = [];