Skip to content

Commit 942ebd3

Browse files
committed
refactor(pagination): move and split type in a separated module
1 parent 21683a1 commit 942ebd3

File tree

3 files changed

+33
-29
lines changed

3 files changed

+33
-29
lines changed

packages/kit-headless/src/components/pagination/pagination.tsx

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,12 @@
1+
import { PaginationProps } from './types';
12
import { usePagination } from './use-pagination';
2-
import type { PropFunction } from '@builder.io/qwik';
33
import { component$, Slot } from '@builder.io/qwik';
44

5-
type ArrowLabels = {
6-
previous: string;
7-
next: string;
8-
};
9-
10-
export interface PaginationProps {
11-
selectedPage: number;
12-
totalPages: number;
13-
onPageChange$: PropFunction<(page: number) => void>;
14-
15-
// configuration
16-
siblingCount?: number;
17-
boundaryCount?: number;
18-
hidePrevButton?: boolean;
19-
hideNextButton?: boolean;
20-
disabled?: boolean;
21-
customArrowTexts?: ArrowLabels;
22-
23-
// styling
24-
class?: string;
25-
gap?: string;
26-
defaultClass?: string;
27-
selectedClass?: string;
28-
dividerClass?: string;
29-
}
30-
315
export const Pagination = component$<PaginationProps>((props) => {
326
const {
337
selectedPage,
348
totalPages,
359
onPageChange$,
36-
// configuration
3710
siblingCount,
3811
boundaryCount,
3912
hidePrevButton = false,
@@ -43,7 +16,6 @@ export const Pagination = component$<PaginationProps>((props) => {
4316
previous: previousButtonLabel = 'PREV',
4417
next: nextButtonLabel = 'NEXT',
4518
} = {},
46-
// styling
4719
class: _class,
4820
gap = '10px',
4921
defaultClass,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './pagination-api';
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { PropFunction } from '@builder.io/qwik';
2+
3+
export interface PaginationCoreProps {
4+
selectedPage: number;
5+
totalPages: number;
6+
onPageChange$: PropFunction<(page: number) => void>;
7+
}
8+
9+
export type PaginationStyling = {
10+
class?: string;
11+
gap?: string;
12+
defaultClass?: string;
13+
selectedClass?: string;
14+
dividerClass?: string;
15+
};
16+
17+
export type PaginationConfig = {
18+
siblingCount?: number;
19+
boundaryCount?: number;
20+
hidePrevButton?: boolean;
21+
hideNextButton?: boolean;
22+
disabled?: boolean;
23+
customArrowTexts?: ArrowLabels;
24+
};
25+
26+
type ArrowLabels = {
27+
previous: string;
28+
next: string;
29+
};
30+
31+
export type PaginationProps = PaginationCoreProps & PaginationStyling & PaginationConfig;

0 commit comments

Comments
 (0)