Skip to content

Commit

Permalink
Adjusted mobile pagination styles (fixes #18)
Browse files Browse the repository at this point in the history
  • Loading branch information
MyXoToD committed Sep 3, 2024
1 parent 8d5673c commit fe6826a
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Personal website of Maximilian Boll. Feel free to look around.

![](https://img.shields.io/badge/version-v1.2.2-brightgreen?style=for-the-badge)
![](https://img.shields.io/badge/version-v1.2.3-brightgreen?style=for-the-badge)
![](https://img.shields.io/github/last-commit/MyXoToD/makkusu.dev?style=for-the-badge)
![](https://img.shields.io/github/actions/workflow/status/MyXoToD/makkusu.dev/deploy.yml?style=for-the-badge)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "makkusu.dev",
"version": "1.2.2",
"version": "1.2.3",
"description": "Private website of Maximilian Boll",
"main": "index.js",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions src/_includes/pagination.njk
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% if pagination.pages | length > 1 %}
<div class="pagination">
<a href="{{ pagination.href.first }}" class="pagination__link{% if pagination.pageNumber < 2 %} pagination__link--hidden{% endif %}">First page</a>
<a href="{{ pagination.href.previous }}" class="pagination__link pagination__link--highlight{% if pagination.pageNumber == 0 %} pagination__link--hidden{% endif %}">Newer posts</a>
<a href="{{ pagination.href.first }}" class="pagination__link pagination__link--newest{% if pagination.pageNumber < 2 %} pagination__link--hidden{% endif %}">First page</a>
<a href="{{ pagination.href.previous }}" class="pagination__link pagination__link--newer pagination__link--highlight{% if pagination.pageNumber == 0 %} pagination__link--hidden{% endif %}">Newer posts</a>

<div>{{ pagination.pageNumber + 1 }} of {{ pagination.pages | length }}</div>

<a href="{{ pagination.href.next }}" class="pagination__link pagination__link--highlight{% if pagination.pageNumber == pagination.pages | length - 1 %} pagination__link--hidden{% endif %}">Older posts</a>
<a href="{{ pagination.href.last }}" class="pagination__link{% if pagination.pageNumber >= pagination.pages | length - 2 %} pagination__link--hidden{% endif %}">Last page</a>
<a href="{{ pagination.href.next }}" class="pagination__link pagination__link--older pagination__link--highlight{% if pagination.pageNumber == pagination.pages | length - 1 %} pagination__link--hidden{% endif %}">Older posts</a>
<a href="{{ pagination.href.last }}" class="pagination__link pagination__link--oldest{% if pagination.pageNumber >= pagination.pages | length - 2 %} pagination__link--hidden{% endif %}">Last page</a>
</div>
{% endif %}
42 changes: 42 additions & 0 deletions src/assets/stylesheets/_pagination.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,46 @@
&__link--highlight {
opacity: 1;
}
}

@media screen and (max-width: 680px) {
.pagination {
display: grid;
grid-template-areas: "page page"
"lefttop righttop"
"leftbottom rightbottom";
gap: 1rem;

>*+* {
margin: unset;
}

> div {
text-align: center;
grid-area: page;

&:before {
content: "Page ";
}
}

&__link {
&--newest {
grid-area: leftbottom;
text-align: left;
}
&--newer {
grid-area: lefttop;
text-align: left;
}
&--older {
grid-area: righttop;
text-align: right;
}
&--oldest {
grid-area: rightbottom;
text-align: right;
}
}
}
}
2 changes: 1 addition & 1 deletion src/assets/stylesheets/application.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/assets/stylesheets/application.min.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/blog.njk
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ canonical: /blog/
{% for post in posts %}
{% include 'post.njk' %}
{% endfor %}

{% include 'pagination.njk' %}
</div>
</div>

0 comments on commit fe6826a

Please sign in to comment.