feat(ui): redesign the pagination button on home page

This commit is contained in:
Cotes Chung 2023-09-06 00:13:10 +08:00
parent 414b8f97ce
commit 62bcd601fc
No known key found for this signature in database
GPG key ID: 0D9E54843167A808
5 changed files with 103 additions and 116 deletions

View file

@ -1,6 +1,7 @@
<!-- The paginator for post list on HomgPage. --> <!-- The paginator for post list on HomgPage. -->
<ul class="pagination align-items-center mt-4 mb-1 ps-lg-2"> <nav aria-label="Page Navigation">
<ul class="pagination align-items-center mt-4 mb-0">
<!-- left arrow --> <!-- left arrow -->
{% if paginator.previous_page %} {% if paginator.previous_page %}
{% assign prev_url = paginator.previous_page_path | relative_url %} {% assign prev_url = paginator.previous_page_path | relative_url %}
@ -9,7 +10,7 @@
{% endif %} {% endif %}
<li class="page-item {% unless paginator.previous_page %}disabled{% endunless %}"> <li class="page-item {% unless paginator.previous_page %}disabled{% endunless %}">
<a class="page-link btn-box-shadow" href="{{ prev_url }}" aria-label="previous-page"> <a class="page-link" href="{{ prev_url }}" aria-label="previous-page">
<i class="fas fa-angle-left"></i> <i class="fas fa-angle-left"></i>
</a> </a>
</li> </li>
@ -45,7 +46,7 @@
<!-- show number --> <!-- show number -->
<li class="page-item {% if i == paginator.page %} active{% endif %}"> <li class="page-item {% if i == paginator.page %} active{% endif %}">
<a <a
class="page-link btn-box-shadow" class="page-link"
href="{% if i > 1 %}{{ site.paginate_path | replace: ':num', i | relative_url }}{% else %}{{ '/' | relative_url }}{% endif %}" href="{% if i > 1 %}{{ site.paginate_path | replace: ':num', i | relative_url }}{% else %}{{ '/' | relative_url }}{% endif %}"
> >
{{- i -}} {{- i -}}
@ -55,12 +56,12 @@
<!-- hide number --> <!-- hide number -->
{% if i < pre and left_ellipsis == false %} {% if i < pre and left_ellipsis == false %}
<li class="page-item disabled"> <li class="page-item disabled">
<span class="page-link btn-box-shadow">...</span> <span class="page-link">...</span>
</li> </li>
{% assign left_ellipsis = true %} {% assign left_ellipsis = true %}
{% elsif i > next and right_ellipsis == false %} {% elsif i > next and right_ellipsis == false %}
<li class="page-item disabled"> <li class="page-item disabled">
<span class="page-link btn-box-shadow">...</span> <span class="page-link">...</span>
</li> </li>
{% assign right_ellipsis = true %} {% assign right_ellipsis = true %}
{% endif %} {% endif %}
@ -81,9 +82,10 @@
{% endif %} {% endif %}
<li class="page-item {% unless paginator.next_page_path %}disabled{% endunless %}"> <li class="page-item {% unless paginator.next_page_path %}disabled{% endunless %}">
<a class="page-link btn-box-shadow" href="{{ next_url }}" aria-label="next-page"> <a class="page-link" href="{{ next_url }}" aria-label="next-page">
<i class="fas fa-angle-right"></i> <i class="fas fa-angle-right"></i>
</a> </a>
</li> </li>
</ul> </ul>
</nav>
<!-- .pagination --> <!-- .pagination -->

View file

@ -604,7 +604,7 @@ i {
} }
.btn-box-shadow { .btn-box-shadow {
box-shadow: 0 0 8px 0 var(--btn-box-shadow) !important; box-shadow: var(--card-shadow);
} }
/* overwrite bootstrap muted */ /* overwrite bootstrap muted */

View file

@ -17,10 +17,10 @@
--blockquote-text-color: #868686; --blockquote-text-color: #868686;
--link-color: rgb(138, 180, 248); --link-color: rgb(138, 180, 248);
--link-underline-color: rgb(82, 108, 150); --link-underline-color: rgb(82, 108, 150);
--button-bg: rgb(39, 40, 43); --button-bg: #1e1e1e;
--btn-border-color: rgb(63, 65, 68); --btn-border-color: #2e2f31;
--btn-backtotop-color: var(--text-color); --btn-backtotop-color: var(--text-color);
--btn-backtotop-border-color: var(--btn-border-color); --btn-backtotop-border-color: #212122;
--btn-box-shadow: var(--main-bg); --btn-box-shadow: var(--main-bg);
--card-header-bg: #292929; --card-header-bg: #292929;
--checkbox-color: rgb(118, 120, 121); --checkbox-color: rgb(118, 120, 121);
@ -55,9 +55,7 @@
/* Home page */ /* Home page */
--post-list-text-color: rgb(175, 176, 177); --post-list-text-color: rgb(175, 176, 177);
--btn-patinator-text-color: var(--text-color); --btn-patinator-text-color: var(--text-color);
--btn-paginator-hover-color: rgb(64, 65, 66); --btn-paginator-hover-color: #2e2e2e;
--btn-paginator-border-color: var(--btn-border-color);
--btn-text-color: var(--text-color);
/* Posts */ /* Posts */
--toc-highlight: rgb(116, 178, 243); --toc-highlight: rgb(116, 178, 243);

View file

@ -59,8 +59,6 @@
--post-list-text-color: dimgray; --post-list-text-color: dimgray;
--btn-patinator-text-color: #555555; --btn-patinator-text-color: #555555;
--btn-paginator-hover-color: var(--sidebar-bg); --btn-paginator-hover-color: var(--sidebar-bg);
--btn-paginator-border-color: var(--sidebar-bg);
--btn-text-color: #676666;
/* Posts */ /* Posts */
--toc-highlight: #0550ae; --toc-highlight: #0550ae;

View file

@ -89,8 +89,9 @@
} /* #post-list */ } /* #post-list */
.pagination { .pagination {
color: var(--btn-patinator-text-color); color: var(--text-color);
font-family: Lato, sans-serif; font-family: Lato, sans-serif;
justify-content: space-evenly;
a:hover { a:hover {
text-decoration: none; text-decoration: none;
@ -98,26 +99,27 @@
.page-item { .page-item {
.page-link { .page-link {
color: inherit; color: var(--btn-patinator-text-color);
width: 2.5rem; padding: 0 0.6rem;
height: 2.5rem;
padding: 0;
display: -webkit-box; display: -webkit-box;
-webkit-box-pack: center; -webkit-box-pack: center;
-webkit-box-align: center; -webkit-box-align: center;
border-radius: 50%; border-radius: 0.5rem;
border: 1px solid var(--btn-paginator-border-color); border: 0;
background-color: var(--button-bg); background-color: inherit;
&:hover {
background-color: var(--btn-paginator-hover-color);
}
} }
&.active { &.active {
.page-link { .page-link {
background-color: var(--btn-paginator-hover-color); background-color: var(--btn-paginator-hover-color);
color: var(--btn-text-color); }
}
&:not(.active) {
.page-link {
&:hover {
box-shadow: inset var(--btn-border-color) 0 0 0 1px;
}
} }
} }
@ -126,15 +128,8 @@
.page-link { .page-link {
color: rgba(108, 117, 125, 0.57); color: rgba(108, 117, 125, 0.57);
border-color: var(--btn-paginator-border-color);
background-color: var(--button-bg);
} }
} }
&:first-child .page-link,
&:last-child .page-link {
border-radius: 50%;
}
} /* .page-item */ } /* .page-item */
} /* .pagination */ } /* .pagination */
@ -175,8 +170,6 @@
/* Hide SideBar and TOC */ /* Hide SideBar and TOC */
@media all and (max-width: 830px) { @media all and (max-width: 830px) {
.pagination { .pagination {
justify-content: space-evenly;
.page-item { .page-item {
&:not(:first-child):not(:last-child) { &:not(:first-child):not(:last-child) {
display: none; display: none;
@ -193,16 +186,12 @@
.pagination { .pagination {
font-size: 0.85rem; font-size: 0.85rem;
justify-content: center;
.page-item { .page-item {
&:not(:last-child) { &:not(:last-child) {
margin-right: 0.7rem; margin-right: 0.7rem;
} }
.page-link {
width: 2rem;
height: 2rem;
}
} }
.page-index { .page-index {