This repository was archived by the owner on Dec 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 397
/
Copy pathdocumentation-items.ts
96 lines (88 loc) · 2.98 KB
/
documentation-items.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import {Injectable} from '@angular/core';
export interface DocItem {
id: string;
name: string;
examples?: string[];
}
export interface DocCategory {
id: string;
name: string;
items: DocItem[];
}
const DOCS = [
{
id: 'forms',
name: 'Form Controls',
summary: 'Radio buttons, checkboxes, input fields, sliders, slide toggles, selects',
items: [
{id: 'autocomplete', name: 'Autocomplete', examples: ['autocomplete-overview']},
{id: 'checkbox', name: 'Checkbox', examples: ['checkbox-configurable']},
{id: 'input', name: 'Input', examples: ['input-form']},
{id: 'radio', name: 'Radio button', examples: ['radio-ng-model']},
{id: 'select', name: 'Select', examples: ['select-form']},
{id: 'slider', name: 'Slider', examples: ['slider-configurable']},
{id: 'slide-toggle', name: 'Slide toggle', examples: ['slide-toggle-configurable']},
]
},
{
id: 'nav',
name: 'Navigation',
summary: 'Sidenavs, toolbars, menus',
items: [
{id: 'menu', name: 'Menu', examples: ['menu-icons']},
{id: 'sidenav', name: 'Sidenav', examples: ['sidenav-fab','sidenav-navigation-list']},
{id: 'toolbar', name: 'Toolbar', examples: ['toolbar-multirow']},
]
},
{
id: 'layout',
name: 'Layout',
summary: 'Lists, grid-lists, cards',
items: [
{id: 'list', name: 'List', examples: ['list-sections']},
{id: 'grid-list', name: 'Grid list', examples: ['grid-list-dynamic']},
{id: 'card', name: 'Card', examples: ['card-fancy']},
{id: 'tabs', name: 'Tabs', examples: ['tabs-template-label']},
]
},
{
id: 'buttons',
name: 'Buttons, Indicators & Icons',
summary: 'buttons, button toggles, icons, progress spinners, progress bars',
items: [
{id: 'button', name: 'Button', examples: ['button-types']},
{id: 'button-toggle', name: 'Button toggle', examples: ['button-toggle-exclusive']},
{id: 'chips', name: 'Chips', examples: ['chips-stacked']},
{id: 'icon', name: 'Icon', examples: ['icon-svg']},
{id: 'progress-spinner', name: 'Progress spinner',
examples: ['progress-spinner-configurable']},
{id: 'progress-bar', name: 'Progress bar', examples: ['progress-bar-configurable']},
]
},
{
id: 'modals',
name: 'Popups & Modals',
summary: 'Dialogs, tooltips, snackbars',
items: [
{id: 'dialog', name: 'Dialog', examples: ['dialog-result']},
{id: 'tooltip', name: 'Tooltip', examples: ['tooltip-position']},
{id: 'snack-bar', name: 'Snackbar', examples: ['snack-bar-component']},
]
},
];
const ALL_ITEMS = DOCS.reduce((result, category) => result.concat(category.items), []);
@Injectable()
export class DocumentationItems {
getItemsInCategories(): DocCategory[] {
return DOCS;
}
getAllItems(): DocItem[] {
return ALL_ITEMS;
}
getItemById(id: string): DocItem {
return ALL_ITEMS.find(i => i.id === id);
}
getCategoryById(id: string): DocCategory {
return DOCS.find(c => c.id == id);
}
}