Improve the paginator design for the mobile screens (#331)

This commit is contained in:
Cotes Chung 2021-05-19 11:09:52 +08:00
parent 4fa7c6af6e
commit eb247b8886
2 changed files with 39 additions and 16 deletions

View file

@ -2,13 +2,14 @@
The paginator for post list on HomgPage. The paginator for post list on HomgPage.
--> -->
<ul class="pagination mt-4 mb-0 pl-lg-2"> <ul class="pagination align-items-center mt-4 mb-0 pl-lg-2">
<!-- 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 %}
{% else %} {% else %}
{% assign prev_url = "#" %} {% assign prev_url = "#" %}
{% 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 btn-box-shadow" href="{{ prev_url }}" aria-label="previous-page">
<i class="fas fa-angle-left"></i> <i class="fas fa-angle-left"></i>
@ -65,12 +66,19 @@
{% endfor %} {% endfor %}
<!-- mobile pagination -->
<li class="page-index align-middle">
<span>{{ paginator.page }}</span>
<span class="text-muted">/ {{ paginator.total_pages }}</span>
</li>
<!-- right arrow --> <!-- right arrow -->
{% if paginator.next_page_path %} {% if paginator.next_page_path %}
{% assign next_url = paginator.next_page_path | relative_url %} {% assign next_url = paginator.next_page_path | relative_url %}
{% else %} {% else %}
{% assign next_url = "#" %} {% assign next_url = "#" %}
{% 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 btn-box-shadow" href="{{ next_url }}" aria-label="next-page">
<i class="fas fa-angle-right"></i> <i class="fas fa-angle-right"></i>

View file

@ -3,27 +3,24 @@
*/ */
.pagination { .pagination {
font-size: 1rem; color: var(--btn-patinator-text-color);
font-family: 'Lato', sans-serif;
a:hover { a:hover {
text-decoration: none; text-decoration: none;
} }
.page-item { .page-item {
.page-link { .page-link {
color: var(--btn-patinator-text-color); color: inherit;
width: 2.5rem; width: 2.5rem;
height: 2.5rem; height: 2.5rem;
padding: 0; padding: 0;
text-align: center;
display: -webkit-box; display: -webkit-box;
display: flex;
-webkit-box-pack: center; -webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center; -webkit-box-align: center;
align-items: center;
border-radius: 50%; border-radius: 50%;
border: 1px solid var(--btn-paginator-border-color); border: 1px solid var(--btn-paginator-border-color);
font-family: 'Lato', sans-serif;
background-color: var(--button-bg); background-color: var(--button-bg);
&:hover { &:hover {
background-color: var(--btn-paginator-hover-color); background-color: var(--btn-paginator-hover-color);
@ -49,9 +46,6 @@
&:last-child .page-link { &:last-child .page-link {
border-radius: 50%; border-radius: 50%;
} }
&:not(:last-child) {
margin-right: 0.7rem;
}
} // .page-item } // .page-item
} // .pagination } // .pagination
@ -116,7 +110,15 @@
/* Hide SideBar and TOC */ /* Hide SideBar and TOC */
@media all and (max-width: 830px) { @media all and (max-width: 830px) {
.pagination { .pagination {
justify-content: center; justify-content: space-evenly;
.page-item {
&:not(:first-child):not(:last-child) {
display: none;
}
}
} }
} }
@ -144,12 +146,25 @@
.pagination { .pagination {
font-size: 0.85rem; font-size: 0.85rem;
.page-item .page-link {
width: 2.2rem; .page-item {
height: 2.2rem; &:not(:last-child) {
margin-right: 0.7rem;
} }
.page-link {
width: 2rem;
height: 2rem;
} }
}
.page-index {
display: none;
}
} // .pagination
} }
/* Pannel hidden */ /* Pannel hidden */