-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcomponents.js
69 lines (64 loc) · 1.54 KB
/
components.js
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
// A contact component that captures the user's first name, last name and email address
export const contact = {
name: 'app.Contact',
component: 'Form',
fields: [
{
name: 'firstName',
component: 'TextField',
label: 'First Name',
required: true,
// When block is false, the next field will appear on the same line, i.e. the first name and
// last name will be on the same line
block: false
},
{
name: 'lastName',
component: 'TextField',
label: 'Last Name'
},
{
name: 'email',
component: 'EmailField',
label: 'Email'
}
]
};
// Uses a RecordList to display a list of contacts
export const contacts = {
name: 'app.Contacts',
component: 'RecordList',
label: 'Contacts',
baseFormFactory: {
// This factory creates Contacts
component: 'Factory',
product: {
component: 'app.Contact'
}
},
// We will use local storage to persist the data. This could be easily swapped out to use Firebase
// or some other store. Or, you could create your own custom store to interact with a GraphQL/REST
// API.
store: {
component: 'LocalStorageStore',
storeName: 'contactsLocalStorage'
}
};
// The main app component and the menu option
export const app = {
name: 'app.App',
component: 'App',
menu: {
component: 'Menu',
items: [
{
// The route to the list of contacts
path: '/contacts',
label: 'Contacts',
content: {
component: 'app.Contacts'
}
}
]
}
};