-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathbuilder.ts
145 lines (138 loc) · 3.85 KB
/
builder.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import dynamic from 'next/dynamic'
import { Builder, withChildren } from '@builder.io/react'
export default {
// Put your Builder public API key here:
apiKey: '1c3b72c36b194b318c40d99ec0a3bf75',
}
// Register some components to be used in the drag and drop editor
// https://www.builder.io/c/docs/custom-components-setup
Builder.registerComponent(
// We dynamically import components so they are only downloaded in the browser
// when used
dynamic(() => import('../components/ui/Hero')),
{
name: 'Hero',
image:
'https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fa40b94ab257547c48e4ed8615d3c9d68',
inputs: [
{
name: 'headline',
type: 'text',
defaultValue: 'I am the headline',
},
{
name: 'description',
type: 'longText',
defaultValue: 'I am the description',
},
],
}
)
Builder.registerComponent(
dynamic(() => import('../components/common/Searchbar')),
{
name: 'Searchbar',
image: 'https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ff1dee4516d6f49439b6eca475e4e6848',
}
)
Builder.registerComponent(
dynamic(() => import('../components/ui/Rating')),
{
name: 'Rating',
image: 'https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F086de4d35afb4b86970018a5c1f58df8',
inputs: [
{
name: 'value',
type: 'number',
defaultValue: 4,
},
],
}
)
Builder.registerComponent(
dynamic(() => import('../components/ui/ButtonLink')),
{
name: 'Button',
image:
'https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fadc7254196504a81b673f48f17185469',
inputs: [
{
name: 'link',
type: 'url',
defaultValue: '',
required: true,
},
{
name: 'text',
type: 'text',
defaultValue: 'Click me',
},
],
}
)
Builder.registerComponent(
dynamic(async () =>
withChildren((await import('../components/ui/Container')).default)
),
{
name: 'Container',
canHaveChildren: true,
defaultStyles: {
minHeight: '100px',
},
image:
'https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F1acf9d437adb4130a6b15fcf761fcc98',
}
)
Builder.registerComponent(
dynamic(() => import('../components/common/ProductCell/ProductCell')),
{
name: 'Product Cell',
image:
'https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fbe08488e714c4db0ad3739261b671f42',
inputs: [
// Use an E-commerce integration for your platform to auto populate this list:
// https://www.builder.io/c/docs/plugins-ecom-overview
{
name: 'slug',
type: 'string',
enum: ['new-short-sleeve-t-shirt', 'lightweight-jacket'],
defaultValue: 'lightweight-jacket',
},
{
name: 'variant',
type: 'string',
defaultValue: 'default',
enum: ['default', 'slim', 'simple'],
},
],
}
)
Builder.registerComponent(
dynamic(async () =>
withChildren(await (await import('../components/ui/Collapse')).default)
),
{
name: 'Collapse',
canHaveChildren: true,
image:
'https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F8c248a867984405eb470b26978267528',
inputs: [
{ name: 'title', type: 'text', defaultValue: 'Drop blocks inside me!' },
],
}
)
// Register a custom insert menu to organize your custom componnets
// https://www.builder.io/c/docs/custom-components-visual-editor#:~:text=than%20this%20screenshot.-,organizing%20your%20components%20in%20custom%20sections,-You%20can%20create
Builder.register('insertMenu', {
name: 'My Components',
items: [
{ name: 'Hero' },
{ name: 'Button' },
{ name: 'Searchbar' },
{ name: 'Collapse' },
{ name: 'Rating' },
{ name: 'Container' },
{ name: 'Product Cell' },
],
})