Skip to content

Commit

Permalink
better placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
eebbesen committed Dec 18, 2024
1 parent d2a47ca commit 7653a2f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
@inherits LayoutComponentBase
@using StpFoodBlazor.Models

<span id="deals_table_body_placeholder" class="placeholder-glow" aria-hidden="true">
<span id="deals_table_body_placeholder" aria-hidden="true">
@{var rowCounter = 0;}
@foreach (var deal in Enumerable.Range(1, 30))
{
<div class="row rounded@(rowCounter % 2 == 0 ? " bg-secondary opacity-25" : "")">
@if (string.IsNullOrEmpty(selectedDayOfWeek))
{
<span class="col-1 placeholder"></span>
}
<span class="col-3 placeholder"></span>
<span class="col placeholder"></span>
<div class="row rounded placeholder-glow">
<span class="col-12 rounded placeholder@(rowCounter % 2 == 0 ? " bg-white" : "")"></span>
</div>
rowCounter++;
}
</span>

@code
{
[Parameter]
public string selectedDayOfWeek { get; set; }
}
3 changes: 1 addition & 2 deletions StpFoodBlazor/StpFoodBlazor/Components/Pages/Deals.razor
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
<div class="container mb-5">
<DealFilterBar selectedDayOfWeek="@selectedDayOfWeek" OnSelectedDayChanged="OnSelectedDayChanged"
happyHour="@happyHour" OnHappyHourChanged="OnHappyHourChanged" />

<DealTableHeader selectedDayOfWeek="@selectedDayOfWeek" />
@if (deals == null)
{
<DealTableBodyPlaceholder selectedDayOfWeek="@selectedDayOfWeek" />
<DealTableBodyPlaceholder />
}
else
{
Expand Down
4 changes: 1 addition & 3 deletions StpFoodBlazor/StpFoodBlazorTest/Pages/DealsTest.razor
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
var elements = cut.Find("#deals_table_body_placeholder");

Assert.Equal(30, elements.ChildElementCount);
Assert.Equal("<span class=\"col-1 placeholder\"></span>" +
"<span class=\"col-3 placeholder\"></span>\n " +
"<span class=\"col placeholder\"></span>",
Assert.Equal("<span class=\"col-12 rounded placeholder bg-white\"></span>",
elements.Children[0].InnerHtml);
}

Expand Down

0 comments on commit 7653a2f

Please sign in to comment.