Skip to content

Commit 49dc243

Browse files
Copilotunbug
andauthored
feat: Add gold/silver/bronze rank badges and 推荐 pill labels to top-3 Featured sidebar items (#42)
* feat: add gold/silver/bronze rank badges to top-3 Featured items Agent-Logs-Url: https://github.com/unbug/unbug.github.io/sessions/e65e74c4-4c2c-4211-be4f-4ec005f7232e Co-authored-by: unbug <799578+unbug@users.noreply.github.com> * feat: add 推荐 pill badge to top-3 Featured items Agent-Logs-Url: https://github.com/unbug/unbug.github.io/sessions/0d6583db-7ace-4344-9d35-3a1ae9e6f879 Co-authored-by: unbug <799578+unbug@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: unbug <799578+unbug@users.noreply.github.com>
1 parent 0d6a349 commit 49dc243

2 files changed

Lines changed: 42 additions & 3 deletions

File tree

_includes/sidebar-featured.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<div class="sticky-top sticky-top-offset">
22
<h4 class="font-weight-bold spanborder"><span>Featured</span></h4>
33
<ol class="list-featured">
4-
{% for post in site.tags.featured %}
5-
<li class="mb-4">
4+
{% for post in site.tags.featured %}
5+
{% assign rank = forloop.index %}
6+
<li class="mb-4{% if rank <= 3 %} featured-rank-{{ rank }}{% endif %}">
67
<span>
78
<h6 class="font-weight-bold">
8-
<a href="{{site.baseurl}}{{ post.url }}" class="text-dark">{{ post.title }}</a>
9+
<a href="{{site.baseurl}}{{ post.url }}" class="text-dark">{{ post.title }}</a>{% if rank <= 3 %}<span class="featured-badge featured-badge-{{ rank }}">推荐</span>{% endif %}
910
</h6>
1011
<span class="d-block text-muted">
1112
In <span class="catlist">

assets/css/theme.css

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,44 @@ ol.list-featured li:before {
683683
line-height: 1;
684684
opacity: .1;
685685
}
686+
ol.list-featured li.featured-rank-1:before,
687+
ol.list-featured li.featured-rank-2:before,
688+
ol.list-featured li.featured-rank-3:before {
689+
opacity: 1;
690+
}
691+
ol.list-featured li.featured-rank-1:before {
692+
color: #FFB800;
693+
text-shadow: 0 1px 4px rgba(255,184,0,0.45);
694+
}
695+
ol.list-featured li.featured-rank-2:before {
696+
color: #A0A0A0;
697+
text-shadow: 0 1px 4px rgba(160,160,160,0.45);
698+
}
699+
ol.list-featured li.featured-rank-3:before {
700+
color: #C8763A;
701+
text-shadow: 0 1px 4px rgba(200,118,58,0.45);
702+
}
703+
.featured-badge {
704+
display: inline-block;
705+
font-size: 0.6rem;
706+
font-weight: bold;
707+
line-height: 1;
708+
padding: 2px 5px;
709+
border-radius: 3px;
710+
margin-left: 5px;
711+
vertical-align: middle;
712+
color: #fff;
713+
letter-spacing: 0.03em;
714+
}
715+
.featured-badge-1 {
716+
background-color: #FFB800;
717+
}
718+
.featured-badge-2 {
719+
background-color: #A0A0A0;
720+
}
721+
.featured-badge-3 {
722+
background-color: #C8763A;
723+
}
686724
.catlist .sep:last-child {
687725
display:none;
688726
}

0 commit comments

Comments
 (0)