Skip to content

Commit

Permalink
pkp/pkp-lib#8884 Update design for the Pagination component
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr authored and Vitaliy-1 committed Aug 10, 2023
1 parent 19635f8 commit 61bb14c
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 56 deletions.
26 changes: 17 additions & 9 deletions src/components/Button/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,11 @@ export default {
border-color: @primary;
}
&:focus {
&:focus-visible {
color: @primary;
border-color: @primary;
outline: 1px solid @primary;
}
&:active {
box-shadow: 0 0 2px;
}
}
/**
Expand All @@ -102,22 +98,30 @@ export default {
box-shadow: 0 1px 0 @primary;
&:hover,
&:focus {
&:focus-visible {
background: @primary-lift;
color: #fff;
}
}
.pkpButton--isLink {
font-weight: @normal;
text-transform: uppercase;
box-shadow: none;
border-color: transparent;
text-decoration: underline;
&:hover {
color: @primary-lift;
border-color: transparent;
}
}
.pkpButton--isWarnable {
color: @no;
&:hover,
&:focus {
&:focus-visible {
border-color: @no;
color: @no;
}
Expand All @@ -133,7 +137,7 @@ export default {
box-shadow: 0 1px 0 @primary;
&:hover,
&:focus {
&:focus-visible {
background: @primary-lift;
color: #fff;
}
Expand All @@ -147,10 +151,14 @@ export default {
box-shadow: none;
&:hover,
&:focus {
&:focus-visible {
cursor: not-allowed;
outline: none;
box-shadow: none;
}
}
.pkpButton--isLink:disabled {
border-color: transparent;
}
</style>
53 changes: 24 additions & 29 deletions src/components/Pagination/Pagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
page: __('common.pagination.previous'),
})
"
:is-link="true"
@click="setPage('previous')"
>
{{ __('common.pagination.previous') }}
Expand All @@ -35,10 +36,8 @@
:disabled="item.isDisabled"
:aria-label="item.ariaLabel"
:aria-current="item.isCurrent"
:is-link="
!item.isCurrent && !['previous', 'next'].includes(item.value)
"
:is-active="item.isCurrent"
class="pkpPagination__page"
:is-link="true"
@click="setPage(item.value)"
>
{{ item.label }}
Expand All @@ -47,6 +46,7 @@
<li>
<pkp-button
:disabled="currentPage === lastPage"
:is-link="true"
@click="setPage('next')"
>
{{ __('common.pagination.next') }}
Expand Down Expand Up @@ -183,34 +183,35 @@ export default {
@import '../../styles/_import';
.pkpPagination {
display: flex;
justify-content: flex-start;
font-size: @font-tiny;
line-height: 1.5em;
text-align: center;
ul {
display: flex;
align-items: center;
margin: 0;
padding: 0;
list-style: none;
}
li {
display: inline-block;
margin-left: 1px;
margin-right: 1px;
.pkpButton {
padding-inline-start: 0.75rem;
padding-inline-end: 0.75rem;
}
&:first-child {
float: left;
}
.pkpPagination__page {
padding-inline-start: 0.5rem;
padding-inline-end: 0.5rem;
text-decoration: none;
color: @text;
&:last-child {
float: right;
&[aria-current='true'] {
font-weight: @bold;
}
}
.pkpButton {
padding-left: 0.75rem;
padding-right: 0.75rem;
}
}
.pkpPagination__separator {
Expand All @@ -224,16 +225,10 @@ export default {
width: 34px;
}
[dir='rtl'] {
.pkpPagination {
li {
&:first-child {
float: right;
}
&:last-child {
float: left;
}
}
}
/**
* Pagination components inside of a ListPanel footer
*/
.listPanel__footer .pkpPagination {
justify-content: flex-end;
}
</style>
30 changes: 17 additions & 13 deletions src/docs/components/Pagination/previews/PreviewPagination.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
<template>
<div class="previewPagination">
<pagination
:current-page="currentPage"
:last-page="10"
:isLoading="isLoading"
@set-page="setPage"
/>
<pagination
:current-page="currentPage"
:last-page="10"
:show-adjacent-pages="2"
:isLoading="isLoading"
@set-page="setPage"
/>
<div style="display: flex; justify-content: center">
<pagination
:current-page="currentPage"
:last-page="10"
:isLoading="isLoading"
@set-page="setPage"
/>
</div>
<div style="display: flex; justify-content: center; margin-top: 2em">
<pagination
:current-page="currentPage"
:last-page="10"
:show-adjacent-pages="2"
:isLoading="isLoading"
@set-page="setPage"
/>
</div>
</div>
</template>

Expand Down
14 changes: 9 additions & 5 deletions src/docs/components/Table/previews/PreviewPagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,26 @@
</table-cell>
</tr>
</pkp-table>
<pagination
:currentPage="currentPage"
:lastPage="lastPage"
@set-page="setPage"
/>
<button-row>
<pagination
:currentPage="currentPage"
:lastPage="lastPage"
@set-page="setPage"
/>
</button-row>
</div>
</template>

<script>
import PreviewTable from './PreviewTable.vue';
import Pagination from '@/components/Pagination/Pagination.vue';
import articleStats from '../helpers/articleStats.js';
import ButtonRow from '../../../../components/ButtonRow/ButtonRow.vue';
export default {
extends: PreviewTable,
components: {
ButtonRow,
Pagination,
},
data() {
Expand Down

0 comments on commit 61bb14c

Please sign in to comment.