From 5ede008504a149d4b78b701e5aa40cd9c56bdaef Mon Sep 17 00:00:00 2001 From: tblivet Date: Fri, 17 May 2024 18:10:38 +0200 Subject: [PATCH] feat: improve pagination Enhanced pagination and added mobile optimizations. --- .../components/category/_pagination.scss | 54 +++++++++++++++++++ templates/_partials/pagination.tpl | 43 ++++++++++----- 2 files changed, 83 insertions(+), 14 deletions(-) diff --git a/src/scss/custom/components/category/_pagination.scss b/src/scss/custom/components/category/_pagination.scss index d0769ce57..296e723c8 100644 --- a/src/scss/custom/components/category/_pagination.scss +++ b/src/scss/custom/components/category/_pagination.scss @@ -7,4 +7,58 @@ $component-name: pagination; font-size: 1rem; color: var(--bs-gray-600); } + + @include media-breakpoint-down(sm) { + position: relative; + margin-bottom: 3.5rem; + + .page-item { + &:nth-child(2) { + .page-link { + border-top-left-radius: var(--bs-pagination-border-radius); + border-bottom-left-radius: var(--bs-pagination-border-radius); + } + } + + &:nth-last-child(2) { + .page-link { + border-top-right-radius: var(--bs-pagination-border-radius); + border-bottom-right-radius: var(--bs-pagination-border-radius); + } + } + + &.disabled { + .page-link { + padding-inline: 0.375rem; + } + } + + &:has(.previous), + &:has(.next) { + position: absolute; + top: calc(100% + 0.5rem); + transform-origin: center; + } + + &:has(.previous) { + left: 50%; + transform: translateX(calc(-100% - 0.25rem)); + } + + &:has(.next) { + right: 50%; + transform: translateX(calc(100% + 0.25rem)); + } + } + + .page-link { + padding-inline: 0.625rem; + + &.previous, + &.next { + padding: 0.5rem; + border-radius: 50%; + } + } + } } diff --git a/templates/_partials/pagination.tpl b/templates/_partials/pagination.tpl index 16bda5e95..ef99b5891 100644 --- a/templates/_partials/pagination.tpl +++ b/templates/_partials/pagination.tpl @@ -16,25 +16,40 @@