-
Notifications
You must be signed in to change notification settings - Fork 831
/
pagination.ts
65 lines (62 loc) · 1.47 KB
/
pagination.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import {Pagination} from 'baseui/pagination';
import {PropTypes} from 'react-view';
import {TConfig} from '../types';
const paginationProps = require('!!extract-react-types-loader!../../../../src/pagination/pagination.js');
const PaginationConfig: TConfig = {
imports: {
'baseui/pagination': {
named: ['Pagination'],
},
},
scope: {Pagination},
theme: ['paginationTriangleDown'],
props: {
numPages: {
value: 20,
type: PropTypes.Number,
description: 'The total number of pages available.',
},
currentPage: {
value: 1,
type: PropTypes.Number,
description: 'The currently selected page.',
stateful: true,
},
onPageChange: {
value: `({nextPage}) => {
setCurrentPage(
Math.min(
Math.max(nextPage, 1),
20,
)
);
}`,
type: PropTypes.Function,
description: `Function called when page is changed.`,
propHook: {
what: 'Math.min(Math.max(nextPage, 1), 20)',
into: 'currentPage',
},
},
overrides: {
value: undefined,
type: PropTypes.Custom,
description: 'Lets you customize all aspects of the component.',
custom: {
names: [
'Root',
'MaxLabel',
'DropdownContainer',
'Select',
'NextButton',
'PrevButton',
],
sharedProps: {},
},
},
},
mapTokensToProps: {
Pagination: paginationProps,
},
};
export default PaginationConfig;