Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination text & buttons alignment #76

Open
gouravkhunger opened this issue Jun 20, 2023 · 3 comments
Open

Pagination text & buttons alignment #76

gouravkhunger opened this issue Jun 20, 2023 · 3 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@gouravkhunger
Copy link
Member

gouravkhunger commented Jun 20, 2023

The pagination info text is not well aligned on the first and last pages where either of the previous / next buttons is absent.

image
@gouravkhunger gouravkhunger added the good first issue Good for newcomers label Jun 20, 2023
@Akash1965
Copy link

Hi @gouravkhunger can you please assign this issue to me

@gouravkhunger
Copy link
Member Author

Hey @Akash1965, sure! I'll elaborate the issue here:

image image

As you can see: if the previous/next button is absent, the text "Page _ of _" moves from its position. This is because the div content is centered in the current logic of rendering:

{% if paginator.total_pages > 1 %}
<div class="flex justify-center items-center w-full">
{% if paginator.previous_page %}
<a
href="{{ site.baseurl }}{{ paginator.previous_page_path }}"
class="mr-2 px-2 py-0.5 hover:shadow-xl hover:shadow-slate-200 dark:hover:shadow-none rounded-md bg-background dark:bg-slate-100 dark:text-black text-white text-lg hover:scale-110 transition underline-none"
>
Previous
</a>
{% endif %}
<span>Page {{ paginator.page }} of {{ paginator.total_pages }}</span>
{% if paginator.next_page %}
<a
href="{{ site.baseurl }}{{ paginator.next_page_path }}"
class="ml-2 px-2 py-0.5 hover:shadow-xl hover:shadow-slate-200 dark:hover:shadow-none rounded-md bg-background dark:bg-slate-100 dark:text-black text-white text-lg hover:scale-110 transition underline-none"
>
Next
</a>
{% endif %}
</div>
{% endif %}

A possible solution is to always have previous/next buttons by removing the if checks, but add the tailwind class invisible using the same conditional logic. So that the element is not shown, but takes up space it requires. This will preserve symmetry.

Let me know if you need further clarification.

Thanks!

@gouravkhunger
Copy link
Member Author

Also, if you are on mac / linux you can follow the local setup guide to begin building locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants