-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcomponents.tsx
83 lines (70 loc) · 2.12 KB
/
components.tsx
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
import { indexBy, prop, sortBy } from 'ramda';
import { ReactNode } from 'react-transition-group/node_modules/@types/react';
import { Alert, alertComponent } from './components/alert';
import { AppBar, appBarComponent } from './components/appBar';
import { Avatar, avatar } from './components/avatar';
import { AvatarGroup, avatarGroup } from './components/avatarGroup';
import { Button, button } from './components/button';
import { Checkbox, checkbox } from './components/checkbox';
import { DatePicker, datePicker } from './components/datePicker';
import { ErrorBoundary, errorBoundary } from './components/errorBoundary';
import { Pagination, pagination } from './components/pagination';
import { Select, select } from './components/select';
import { Stepper, stepper } from './components/stepper';
import { Switch, switchComponent } from './components/switch';
import { Tabs, tabs } from './components/tabs';
import { CapitalLetter, Sentence } from './entities';
export type Component =
| Alert
| AppBar
| Avatar
| AvatarGroup
| Button
| Checkbox
| DatePicker
| ErrorBoundary
| Pagination
| Select
| Stepper
| Switch
| Tabs;
type OptionId = string;
export interface Option {
criteria: Sentence;
name: string;
optionId: OptionId;
toJsx: (any: any) => ReactNode | string;
toMarkdown: (any: any) => string;
}
type OptionsById = {
[optionId in OptionId]: Option;
};
export type SuperString = string | {
jsx: ReactNode;
markdown: string;
};
export interface ComponentInfo {
componentId: string;
/** The typical name used by the layman to identify this component. */
cannonicalName: `${CapitalLetter}${string}`;
/** The English indefinte article to be used to refer to this Component */
indefiniteArticle: 'a' | 'an';
description: SuperString;
optionsById: OptionsById;
}
export const componentInfo: ComponentInfo[] = sortBy(prop('componentId'), [
appBarComponent,
alertComponent,
avatar,
avatarGroup,
button,
checkbox,
datePicker,
errorBoundary,
pagination,
select,
stepper,
switchComponent,
tabs,
]);
export const componentInfoById = indexBy(prop('componentId'), componentInfo);