-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathpagination.ts
62 lines (59 loc) · 1.85 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
import { ComponentInfo } from '../components';
import { BaseComponent } from '../entities';
import { checkmark, indexByOptionId, stringArray } from '../utils';
const componentId = 'pagination';
export interface Pagination extends BaseComponent {
componentId: typeof componentId;
options: {
compact: boolean;
edgePages: boolean;
firstLast: boolean;
numPages: boolean;
pageSize: boolean;
style: ('items' | 'pages')[];
};
}
export const pagination: ComponentInfo = {
cannonicalName: 'Pagination',
componentId,
description: 'Pagination allows long lists to be divided into several pages.',
indefiniteArticle: 'a',
optionsById: indexByOptionId([
{
criteria: 'Has a mode that greatly conserves horizontal space, likely by omitting multiple page selectors.',
name: 'Compact',
optionId: 'compact',
...checkmark,
},
{
criteria: 'Allows configuring the number of items that will be shown at the beginning and end of the range.',
name: 'Edge #',
optionId: 'edgePages',
...checkmark,
},
{
criteria: 'Has ready-made functionality to allow users to quickly select first and last pages (either with a stationary page number or a dedicated button).',
name: 'First/Last',
optionId: 'firstLast',
...checkmark,
},
{
criteria: 'Allows the number of page items shown to be configurable.',
name: '# of Pages',
optionId: 'numPages',
...checkmark,
},
{
criteria: 'Allows configuring the number of items that will be shown per page.',
name: 'Page Size',
optionId: 'pageSize',
...checkmark,
},
{
criteria: 'Has an API the is oriented around pages (but disregards pages) or items (and figures out pages automatically).',
name: 'Style',
optionId: 'style',
...stringArray,
},
]),
};