From 036e5b6fffac405582381640e9783e73bd1a77a9 Mon Sep 17 00:00:00 2001 From: Nate Wright Date: Tue, 25 Apr 2023 14:37:58 +0100 Subject: [PATCH] pkp/pkp-lib#8884 Update design for the Pagination component --- src/components/Button/Button.vue | 26 +++++---- src/components/Pagination/Pagination.vue | 53 +++++++++---------- .../Pagination/previews/PreviewPagination.vue | 30 ++++++----- .../Table/previews/PreviewPagination.vue | 14 +++-- 4 files changed, 67 insertions(+), 56 deletions(-) diff --git a/src/components/Button/Button.vue b/src/components/Button/Button.vue index 79bd3f136..cb54668b7 100644 --- a/src/components/Button/Button.vue +++ b/src/components/Button/Button.vue @@ -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; - } } /** @@ -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; } @@ -133,7 +137,7 @@ export default { box-shadow: 0 1px 0 @primary; &:hover, - &:focus { + &:focus-visible { background: @primary-lift; color: #fff; } @@ -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; +} diff --git a/src/components/Pagination/Pagination.vue b/src/components/Pagination/Pagination.vue index 258191448..ed0d96319 100644 --- a/src/components/Pagination/Pagination.vue +++ b/src/components/Pagination/Pagination.vue @@ -13,6 +13,7 @@ page: __('common.pagination.previous'), }) " + :is-link="true" @click="setPage('previous')" > {{ __('common.pagination.previous') }} @@ -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 }} @@ -47,6 +46,7 @@
  • {{ __('common.pagination.next') }} @@ -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 { @@ -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; } diff --git a/src/docs/components/Pagination/previews/PreviewPagination.vue b/src/docs/components/Pagination/previews/PreviewPagination.vue index 6f20a1dfb..32c2d5626 100644 --- a/src/docs/components/Pagination/previews/PreviewPagination.vue +++ b/src/docs/components/Pagination/previews/PreviewPagination.vue @@ -1,18 +1,22 @@ diff --git a/src/docs/components/Table/previews/PreviewPagination.vue b/src/docs/components/Table/previews/PreviewPagination.vue index 29e2baad8..670ce5fa4 100644 --- a/src/docs/components/Table/previews/PreviewPagination.vue +++ b/src/docs/components/Table/previews/PreviewPagination.vue @@ -23,11 +23,13 @@ - + + + @@ -35,10 +37,12 @@ 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() {