Compare commits

..

No commits in common. "ce53457f9ca478ae67178ecc4110856c09994471" and "a175e39eed4bd9ebe918765369f5ad86daebb834" have entirely different histories.

4 changed files with 79 additions and 56 deletions

View file

@ -24,10 +24,6 @@
border-right: 1px solid var(--border-color); border-right: 1px solid var(--border-color);
margin-right: -1px; margin-right: -1px;
} }
&:hover {
background-color: var(--default-color);
}
} }
.title { .title {

View file

@ -38,6 +38,6 @@
} }
.total { .total {
margin: 0.75rem 0; margin: 1rem 0;
} }
} }

View file

@ -4,8 +4,71 @@
display: flex; display: flex;
text-align: center; text-align: center;
justify-content: space-between; justify-content: space-between;
margin: 0.75rem 0; margin: 1rem 0;
.pagination-previous,
.pagination-next,
.pagination-link {
align-items: center;
border: 1px solid transparent;
border-radius: .375em;
box-shadow: none;
display: inline-flex;
font-size: 1rem;
height: 2.5em;
justify-content: flex-start;
line-height: 1.5;
padding-bottom: calc(.5em - 1px);
padding-left: calc(.75em - 1px);
padding-right: calc(.75em - 1px);
padding-top: calc(.5em - 1px);
position: relative;
vertical-align: top;
text-decoration: none;
user-select: none;
text-align: center;
font-size: 1em;
justify-content: center;
margin: .25rem;
border-color: var(--pagination-border-color);
color: var(--pagination-text-color);
min-width: 2.5em;
padding-left: .75em;
padding-right: .75em;
white-space: nowrap;
margin-bottom: 0;
margin-top: 0;
@include transition() {}
&:hover {
border-color: var(--pagination-border-hover-color);
color: var(--pagination-text-hover-color);
}
&.is-disabled {
background-color: var(--default-hl-color);
border-color: var(--default-hl-color);
box-shadow: none;
color: var(--disabled-color);
opacity: .5;
}
}
.pagination-previous-next {
order: 2;
}
// .pagination-next {
// order: 3;
// }
.pagination-link {
&.is-current {
background-color: var(--primary-bg-color);
border-color: var(--primary-bg-color);
color: var(--primary-font-color);
}
}
.pagination-list { .pagination-list {
align-items: center; align-items: center;
@ -14,56 +77,16 @@
flex-wrap: wrap; flex-wrap: wrap;
flex-grow: 1; flex-grow: 1;
flex-shrink: 1; flex-shrink: 1;
justify-content: flex-end; justify-content: flex-start;
order: 1;
}
@include respond-to("small") { @include respond-to("small") {
justify-content: center; flex-direction: column;
}
.pagination-link { .pagination-previous-next {
align-items: center; margin-bottom: 1rem;
border: 1px solid transparent; order: 1;
border-radius: .375em;
box-shadow: none;
display: inline-flex;
font-size: 1rem;
height: 2.5em;
justify-content: flex-start;
line-height: 1.5;
padding: calc(.5em - 1px) calc(.75em - 1px);
position: relative;
vertical-align: top;
text-decoration: none;
user-select: none;
text-align: center;
font-size: 1em;
justify-content: center;
margin: .25rem;
border-color: var(--pagination-border-color);
color: var(--pagination-text-color);
min-width: 2.5em;
white-space: nowrap;
@include transition() {}
&:hover {
border-color: var(--pagination-border-hover-color);
color: var(--pagination-text-hover-color);
}
&.is-disabled {
background-color: var(--default-hl-color);
border-color: var(--default-hl-color);
box-shadow: none;
color: var(--disabled-color);
opacity: .5;
}
&.is-current {
background-color: var(--primary-bg-color);
border-color: var(--primary-bg-color);
color: var(--primary-font-color);
}
} }
} }
} }

View file

@ -76,14 +76,18 @@
<strong>Nombre total d'éléments : </strong>{{total}} <strong>Nombre total d'éléments : </strong>{{total}}
</div> </div>
<nav class="pagination" role="navigation" aria-label="Pagination"> <nav class="pagination" role="navigation" aria-label="Pagination">
<div class="pagination-previous-next">
<a class="pagination-previous" :class="{'is-disabled': page === 1}" @click="previous">Précédent</a>
<a class="pagination-next" :class="{'is-disabled': !total || (page*limit) >= total}" @click="next">Suivant</a>
</div>
<ul class="pagination-list"> <ul class="pagination-list">
<template v-for="p in Array.from({length: totalPages}, (v, i) => (i+1))"> <template v-for="p in Array.from({length: totalPages}, (v, i) => (i+1))">
<template v-if="p < 2 || p > (totalPages - 1) || (page - 1) <= p && page + 1 >= p"> <template v-if="p < 4 || p > (totalPages - 3) || (page - 3) <= p && page + 3 >= p">
<li> <li>
<a class="pagination-link" :class="{'is-current': p === page}" @click="goTo(p)" aria-label="Aller à la page {{p}}">{{ p }}</a> <a class="pagination-link" :class="{'is-current': p === page}" @click="goTo(p)" aria-label="Aller à la page {{p}}">{{ p }}</a>
</li> </li>
</template> </template>
<template v-if="(page - 3 === p && page - 2 > 1) || (page + 2 === p && page + 2 < totalPages - 1)"> <template v-if="(page - 3 - 1 === p && page - 4 > 3) || (page + 4 === p && page + 3 < totalPages - 3)">
<li> <li>
<a class="pagination-link is-disabled">…</a> <a class="pagination-link is-disabled">…</a>
</li> </li>