diff --git a/src/lib-components/SectionPagination.vue b/src/lib-components/SectionPagination.vue index 3ed546c50..2f4a585a7 100644 --- a/src/lib-components/SectionPagination.vue +++ b/src/lib-components/SectionPagination.vue @@ -1,116 +1,196 @@ diff --git a/src/stories/SectionPagination.stories.js b/src/stories/SectionPagination.stories.js index 60d1e131c..27fdf03bd 100644 --- a/src/stories/SectionPagination.stories.js +++ b/src/stories/SectionPagination.stories.js @@ -1,6 +1,21 @@ +import { computed } from 'vue' import SectionPagination from '@/lib-components/SectionPagination' -// Storybook default settings +/** + * A component to provide pagination for a list of items. It can be used in 2 ways: + * + * 1. With a previous and next page string, and no # buttons. In this mode the props determine if the buttons are shown or not + * 2. With a number of pages and a number representing the initial current page. In this mode the component will show the # buttons, and it will only hide the previous and next buttons if the current page is the first or last page + * + * Props: + * - nextTo: A string representing the URL to the next page + * - previousTo: A string representing the URL to the previous page + * + * Props added 2024-10-29: + * + * - pages: A number representing the total number of pages we need to show all content + * - initialCurrentPage: A number representing the page we are starting on + */ export default { title: 'SECTION / Pagination', component: SectionPagination, @@ -26,3 +41,22 @@ export function LastPage() { template: '', } } + +export function WithPagesAndCurrentPage() { + return { + components: { SectionPagination }, + template: '', + } +} + +export function FTVA() { + return { + components: { SectionPagination }, + provide() { + return { + theme: computed(() => 'ftva'), + } + }, + template: '', + } +} diff --git a/src/styles/default/_section-pagination.scss b/src/styles/default/_section-pagination.scss new file mode 100644 index 000000000..0825dfc83 --- /dev/null +++ b/src/styles/default/_section-pagination.scss @@ -0,0 +1,99 @@ +.section-pagination { + max-width: 990px; + + font-family: var(--font-secondary); + font-size: 18px; + padding-left: 13px; + + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: space-between; + align-content: center; + align-items: center; + + .previous { + display: flex; + align-items: center; + } + + .next { + display: flex; + align-items: center; + } + + .previous-svg { + transform: scaleX(-1); + margin-right: 5px; + } + + .next-svg { + margin-left: 5px; + } + + &.first-page { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: flex-end; + align-content: stretch; + align-items: center; + } + + &.last-page { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: flex-start; + align-content: stretch; + align-items: center; + } + + .pagination-numbers-container { + width: 100%; + display: flex; + justify-content: center; + align-items: center; + // general functional styles for page-buttons + .pButton { + display: inline-block; + margin-bottom: 0; + text-align: center; + white-space: nowrap; + vertical-align: middle; + -ms-touch-action: manipulation; + touch-action: manipulation; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-image: none; + background-color: transparent; + color: var(--color-secondary-grey-04); + font-size: 18px; + padding: 0 12px; + border: none; + border-radius: 4px; + margin: 0 6px; + } + + .pButton-selected { + background-color: var(--color-primary-blue-01); + } + } + + // Hover states + @media #{$has-hover} { + + .previous:hover, + .previous:active { + color: var(--color-primary-blue-03); + } + + .next:hover, + .next:active { + color: var(--color-primary-blue-03); + } + } +} \ No newline at end of file diff --git a/src/styles/ftva/_section-pagination.scss b/src/styles/ftva/_section-pagination.scss new file mode 100644 index 000000000..e04fb0647 --- /dev/null +++ b/src/styles/ftva/_section-pagination.scss @@ -0,0 +1,22 @@ +.ftva.section-pagination { + .previous, .next { + @include ftva-text-link-default; + text-decoration: none; + } + .pagination-numbers-container { + .pButton { + color: $body-grey; + font-family: "Karbon", Helvetica, Arial, sans-serif; + font-size: 20px; + font-weight: 500; + transition: background-color 0.3s; + &:hover { + background-color: $grey-blue; + } + } + .pButton-selected { + color: white; + background-color: $navy-blue; + } + } +} \ No newline at end of file