diff --git a/libs/ui/inputs/src/lib/previous-next-buttons/previous-next-buttons.component.spec.ts b/libs/ui/layout/src/lib/previous-next-buttons/previous-next-buttons.component.spec.ts
similarity index 80%
rename from libs/ui/inputs/src/lib/previous-next-buttons/previous-next-buttons.component.spec.ts
rename to libs/ui/layout/src/lib/previous-next-buttons/previous-next-buttons.component.spec.ts
index 95ac4c3eb5..588e4b5264 100644
--- a/libs/ui/inputs/src/lib/previous-next-buttons/previous-next-buttons.component.spec.ts
+++ b/libs/ui/layout/src/lib/previous-next-buttons/previous-next-buttons.component.spec.ts
@@ -1,9 +1,19 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
-
import { PreviousNextButtonsComponent } from './previous-next-buttons.component'
import { TranslateModule } from '@ngx-translate/core'
import { By } from '@angular/platform-browser'
import { DebugElement } from '@angular/core'
+import { Paginable } from '../paginable.interface'
+
+class MockPaginable implements Paginable {
+ currentPage = 1
+ pagesCount = 5
+ isFirstPage = true
+ isLastPage = false
+ goToPage = jest.fn()
+ goToPrevPage = jest.fn()
+ goToNextPage = jest.fn()
+}
describe('PreviousNextButtonsComponent', () => {
let component: PreviousNextButtonsComponent
@@ -19,6 +29,7 @@ describe('PreviousNextButtonsComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(PreviousNextButtonsComponent)
component = fixture.componentInstance
+ component.listComponent = new MockPaginable()
compiled = fixture.debugElement
})
@@ -28,8 +39,8 @@ describe('PreviousNextButtonsComponent', () => {
describe('onFirstElement', () => {
beforeEach(() => {
- component.isFirst = true
- component.isLast = false
+ component.listComponent.isFirstPage = true
+ component.listComponent.isLastPage = false
fixture.detectChanges()
})
@@ -48,8 +59,8 @@ describe('PreviousNextButtonsComponent', () => {
describe('onLastElement', () => {
beforeEach(() => {
- component.isFirst = false
- component.isLast = true
+ component.listComponent.isFirstPage = false
+ component.listComponent.isLastPage = true
fixture.detectChanges()
})
diff --git a/libs/ui/layout/src/lib/previous-next-buttons/previous-next-buttons.component.stories.ts b/libs/ui/layout/src/lib/previous-next-buttons/previous-next-buttons.component.stories.ts
new file mode 100644
index 0000000000..a65bafa6ac
--- /dev/null
+++ b/libs/ui/layout/src/lib/previous-next-buttons/previous-next-buttons.component.stories.ts
@@ -0,0 +1,26 @@
+import { Meta, moduleMetadata, StoryObj } from '@storybook/angular'
+import { PreviousNextButtonsComponent } from './previous-next-buttons.component'
+import { MockListComponent } from '../pagination/pagination.component.stories'
+
+export default {
+ title: 'Layout/Pagination/PreviousNextButtonsComponent',
+ component: PreviousNextButtonsComponent,
+ parameters: {
+ backgrounds: {
+ default: 'dark',
+ },
+ },
+ decorators: [
+ moduleMetadata({
+ imports: [MockListComponent],
+ }),
+ ],
+} as Meta
+
+export const Primary: StoryObj = {
+ render: () => ({
+ template: `
+
+`,
+ }),
+}
diff --git a/libs/ui/inputs/src/lib/previous-next-buttons/previous-next-buttons.component.ts b/libs/ui/layout/src/lib/previous-next-buttons/previous-next-buttons.component.ts
similarity index 53%
rename from libs/ui/inputs/src/lib/previous-next-buttons/previous-next-buttons.component.ts
rename to libs/ui/layout/src/lib/previous-next-buttons/previous-next-buttons.component.ts
index 9e95996105..889428f6cf 100644
--- a/libs/ui/inputs/src/lib/previous-next-buttons/previous-next-buttons.component.ts
+++ b/libs/ui/layout/src/lib/previous-next-buttons/previous-next-buttons.component.ts
@@ -1,11 +1,4 @@
-import {
- ChangeDetectionStrategy,
- Component,
- EventEmitter,
- Input,
- Output,
-} from '@angular/core'
-import { ButtonComponent } from '../button/button.component'
+import { Component, Input } from '@angular/core'
import {
NgIconComponent,
provideIcons,
@@ -15,12 +8,13 @@ import {
matArrowBack,
matArrowForward,
} from '@ng-icons/material-icons/baseline'
+import { Paginable } from '../paginable.interface'
+import { ButtonComponent } from '@geonetwork-ui/ui/inputs'
@Component({
selector: 'gn-ui-previous-next-buttons',
templateUrl: './previous-next-buttons.component.html',
styleUrls: ['./previous-next-buttons.component.css'],
- changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [ButtonComponent, NgIconComponent],
providers: [
@@ -31,16 +25,5 @@ import {
],
})
export class PreviousNextButtonsComponent {
- @Input() isFirst: boolean
- @Input() isLast: boolean
-
- @Output() directionButtonClicked: EventEmitter = new EventEmitter()
-
- previousButtonClicked() {
- this.directionButtonClicked.next('previous')
- }
-
- nextButtonClicked() {
- this.directionButtonClicked.next('next')
- }
+ @Input() listComponent: Paginable
}