Skip to content

Commit b193f64

Browse files
committed
feat: add difficulty badges to tips for better user guidance
1 parent d25b06c commit b193f64

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

Web/Pages/Index.cshtml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
<small class="text-muted">@tip.PublishedDate.ToString("MMM dd, yyyy")</small>
6969
</div>
7070
<h5 class="card-title">@tip.Title</h5>
71-
<p class="card-text text-truncate-3">@tip.Description</p> <div class="d-flex flex-wrap gap-1 mb-2" style="max-width: 100%; overflow: hidden;">
71+
<p class="card-text text-truncate-3">@tip.Description</p>
72+
<div class="d-flex flex-wrap gap-1 mb-2" style="max-width: 100%; overflow: hidden;">
7273
@foreach (var tag in tip.Tags.Take(3))
7374
{
7475
<span class="badge bg-light text-dark text-truncate" style="max-width: 150px;">#@tag</span>
@@ -82,6 +83,16 @@
8283
<div class="card-footer border-0">
8384
<div class="d-flex justify-content-between align-items-center">
8485
<small class="text-muted"><i class="bi bi-clock"></i> @tip.ReadingTimeMinutes min read</small>
86+
@if (!string.IsNullOrEmpty(tip.Difficulty))
87+
{
88+
<span class="badge @(tip.Difficulty switch
89+
{
90+
"Beginner" => "bg-success",
91+
"Intermediate" => "bg-warning text-dark",
92+
"Advanced" => "bg-danger",
93+
_ => "bg-secondary"
94+
})">@tip.Difficulty</span>
95+
}
8596
<a asp-page="/Tips/Details" asp-route-slug="@tip.UrlSlug" class="btn btn-sm btn-primary">Read More</a>
8697
</div>
8798
</div>

0 commit comments

Comments
 (0)