create-tina-app 0.1.2 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/dist/index.js +50 -16
- package/{examples/tina-tailwind-sidebar-demo/next-env.d.ts → dist/util/preRunChecks.d.ts} +1 -3
- package/package.json +2 -1
- package/examples/tina-tailwind-sidebar-demo/.tina/PageTemplate.ts +0 -427
- package/examples/tina-tailwind-sidebar-demo/.tina/ThemeTemplate.ts +0 -42
- package/examples/tina-tailwind-sidebar-demo/.tina/__generated__/_graphql.json +0 -4180
- package/examples/tina-tailwind-sidebar-demo/.tina/__generated__/_lookup.json +0 -68
- package/examples/tina-tailwind-sidebar-demo/.tina/__generated__/_schema.json +0 -851
- package/examples/tina-tailwind-sidebar-demo/.tina/__generated__/config/schema.json +0 -479
- package/examples/tina-tailwind-sidebar-demo/.tina/__generated__/schema.gql +0 -391
- package/examples/tina-tailwind-sidebar-demo/.tina/__generated__/types.ts +0 -520
- package/examples/tina-tailwind-sidebar-demo/.tina/schema.ts +0 -35
- package/examples/tina-tailwind-sidebar-demo/CHANGELOG.md +0 -95
- package/examples/tina-tailwind-sidebar-demo/LICENSE +0 -201
- package/examples/tina-tailwind-sidebar-demo/README.md +0 -10
- package/examples/tina-tailwind-sidebar-demo/components/PageBlocks.tsx +0 -25
- package/examples/tina-tailwind-sidebar-demo/components/actions.js +0 -114
- package/examples/tina-tailwind-sidebar-demo/components/features.tsx +0 -171
- package/examples/tina-tailwind-sidebar-demo/components/footer.tsx +0 -247
- package/examples/tina-tailwind-sidebar-demo/components/hero.js +0 -156
- package/examples/tina-tailwind-sidebar-demo/components/icon.js +0 -264
- package/examples/tina-tailwind-sidebar-demo/components/modal.js +0 -79
- package/examples/tina-tailwind-sidebar-demo/components/nav.tsx +0 -121
- package/examples/tina-tailwind-sidebar-demo/components/section.js +0 -53
- package/examples/tina-tailwind-sidebar-demo/components/testimonial.tsx +0 -87
- package/examples/tina-tailwind-sidebar-demo/components/theme.tsx +0 -81
- package/examples/tina-tailwind-sidebar-demo/components/tina-wrapper.js +0 -85
- package/examples/tina-tailwind-sidebar-demo/content/data/homepage.json +0 -186
- package/examples/tina-tailwind-sidebar-demo/content/theme/NormalTheme.json +0 -5
- package/examples/tina-tailwind-sidebar-demo/graphql.config.js +0 -24
- package/examples/tina-tailwind-sidebar-demo/package.json +0 -42
- package/examples/tina-tailwind-sidebar-demo/pages/_app.js +0 -48
- package/examples/tina-tailwind-sidebar-demo/pages/admin.tsx +0 -26
- package/examples/tina-tailwind-sidebar-demo/pages/index.tsx +0 -186
- package/examples/tina-tailwind-sidebar-demo/postcss.config.js +0 -19
- package/examples/tina-tailwind-sidebar-demo/public/canal.jpg +0 -0
- package/examples/tina-tailwind-sidebar-demo/public/index.html +0 -42
- package/examples/tina-tailwind-sidebar-demo/styles.css +0 -20
- package/examples/tina-tailwind-sidebar-demo/tailwind.config.js +0 -83
- package/examples/tina-tailwind-sidebar-demo/tsconfig.json +0 -19
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
Copyright 2021 Forestry.io Holdings, Inc.
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License.
|
|
5
|
-
You may obtain a copy of the License at
|
|
6
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software
|
|
8
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
-
See the License for the specific language governing permissions and
|
|
11
|
-
limitations under the License.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import * as React from 'react'
|
|
15
|
-
import { ThemeContext } from './theme'
|
|
16
|
-
import { Blocks } from './PageBlocks'
|
|
17
|
-
import { FaInstagram, FaFacebookF, FaTwitter, FaGithub } from 'react-icons/fa'
|
|
18
|
-
import { Homepage_Footer_Data, Nav_Data } from '../.tina/__generated__/types'
|
|
19
|
-
|
|
20
|
-
export const Footer = ({
|
|
21
|
-
footer,
|
|
22
|
-
name = '',
|
|
23
|
-
navList,
|
|
24
|
-
}: {
|
|
25
|
-
footer: Homepage_Footer_Data
|
|
26
|
-
name: string
|
|
27
|
-
navList: Nav_Data[]
|
|
28
|
-
}) => {
|
|
29
|
-
const theme = React.useContext(ThemeContext)
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<footer className="text-white bg-gradient-to-br from-gray-700 to-gray-800 dark:from-gray-900 dark:to-gray-800 body-font">
|
|
33
|
-
<div className="relative">
|
|
34
|
-
<div className="relative container mx-auto flex pt-8 lg:pt-3 z-10">
|
|
35
|
-
<div className="w-full flex flex-col lg:flex-row flex-wrap py-12 px-8">
|
|
36
|
-
<div className="mb-8 lg:mr-48 flex-grow-0 inline-block">
|
|
37
|
-
<a className="">
|
|
38
|
-
<h2 className="text-lg font-bold tracking-tight text-white uppercase transition duration-500 ease-in-out transform hover:text-lightBlack-500">
|
|
39
|
-
{name}
|
|
40
|
-
</h2>
|
|
41
|
-
</a>
|
|
42
|
-
</div>
|
|
43
|
-
<div className="flex-grow flex flex-wrap justify-between -mx-6">
|
|
44
|
-
{navList?.map((item, i) => {
|
|
45
|
-
switch (item.__typename) {
|
|
46
|
-
case 'Nav_Data':
|
|
47
|
-
return <FooterNav key={i} {...item} />
|
|
48
|
-
}
|
|
49
|
-
})}
|
|
50
|
-
{/* <Blocks data={data.navlist} blocks={FOOTER_BLOCKS} /> */}
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
<div
|
|
55
|
-
className={`overflow-hidden absolute top-0 left-0 w-full h-full flex flex-row justify-center`}
|
|
56
|
-
>
|
|
57
|
-
<span
|
|
58
|
-
className={`absolute opacity-30 w-2/3 h-64 bg-${theme.color}-500 -bottom-48 rounded-t-full`}
|
|
59
|
-
style={{ filter: 'blur(10rem)' }}
|
|
60
|
-
></span>
|
|
61
|
-
</div>
|
|
62
|
-
<div
|
|
63
|
-
className={`relative w-full opacity-90 z-10 bg-gradient-to-r from-gray-800 via-${theme.color}-400 to-gray-800`}
|
|
64
|
-
style={{ height: '3px' }}
|
|
65
|
-
></div>
|
|
66
|
-
<div className="bg-gray-800 dark:bg-gray-900 z-0 relative">
|
|
67
|
-
<div className="container flex flex-col flex-wrap p-7 mx-auto sm:flex-row justify-center">
|
|
68
|
-
<div className="flex justify-center">
|
|
69
|
-
{footer?.social?.facebook && (
|
|
70
|
-
<a
|
|
71
|
-
href={footer.social.facebook}
|
|
72
|
-
target="_blank"
|
|
73
|
-
className="mx-2"
|
|
74
|
-
>
|
|
75
|
-
<FaFacebookF
|
|
76
|
-
className={`h-6 w-auto text-white hover:text-${theme.color}-500`}
|
|
77
|
-
/>
|
|
78
|
-
</a>
|
|
79
|
-
)}
|
|
80
|
-
{footer?.social?.twitter && (
|
|
81
|
-
<a
|
|
82
|
-
href={footer.social.twitter}
|
|
83
|
-
target="_blank"
|
|
84
|
-
className="mx-2"
|
|
85
|
-
>
|
|
86
|
-
<FaTwitter
|
|
87
|
-
className={`h-6 w-auto text-white hover:text-${theme.color}-500`}
|
|
88
|
-
/>
|
|
89
|
-
</a>
|
|
90
|
-
)}
|
|
91
|
-
{footer?.social?.instagram && (
|
|
92
|
-
<a
|
|
93
|
-
href={footer.social.instagram}
|
|
94
|
-
target="_blank"
|
|
95
|
-
className="mx-2"
|
|
96
|
-
>
|
|
97
|
-
<FaInstagram
|
|
98
|
-
className={`h-6 w-auto text-white hover:text-${theme.color}-500`}
|
|
99
|
-
/>
|
|
100
|
-
</a>
|
|
101
|
-
)}
|
|
102
|
-
{footer?.social?.github && (
|
|
103
|
-
<a href={footer.social.github} target="_blank" className="mx-2">
|
|
104
|
-
<FaGithub
|
|
105
|
-
className={`h-6 w-auto text-white hover:text-${theme.color}-500`}
|
|
106
|
-
/>
|
|
107
|
-
</a>
|
|
108
|
-
)}
|
|
109
|
-
</div>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
</footer>
|
|
114
|
-
)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export const FooterNav = (data: Nav_Data) => {
|
|
118
|
-
const theme = React.useContext(ThemeContext)
|
|
119
|
-
|
|
120
|
-
return (
|
|
121
|
-
<div className="flex-grow px-6">
|
|
122
|
-
<h3
|
|
123
|
-
className={`mb-3 text-sm font-semibold tracking-widest text-${theme.color}-400 uppercase title-font`}
|
|
124
|
-
style={{
|
|
125
|
-
textShadow: `0 1px 3px rgba(var(--color-rgb-${theme.color}-600),0.3)`,
|
|
126
|
-
}}
|
|
127
|
-
>
|
|
128
|
-
{data.title}
|
|
129
|
-
</h3>
|
|
130
|
-
<nav className="pb-8 list-none">
|
|
131
|
-
{data.items &&
|
|
132
|
-
data.items.map(function (item, index) {
|
|
133
|
-
return (
|
|
134
|
-
<li key={index}>
|
|
135
|
-
<a
|
|
136
|
-
href={item?.link || ''}
|
|
137
|
-
className="text-sm text-gray-200 hover:text-white"
|
|
138
|
-
>
|
|
139
|
-
{item?.label || ''}
|
|
140
|
-
</a>
|
|
141
|
-
</li>
|
|
142
|
-
)
|
|
143
|
-
})}
|
|
144
|
-
</nav>
|
|
145
|
-
</div>
|
|
146
|
-
)
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export const footer_nav_template = {
|
|
150
|
-
label: 'Footer Nav',
|
|
151
|
-
defaultItem: {
|
|
152
|
-
title: 'Product',
|
|
153
|
-
items: [
|
|
154
|
-
{
|
|
155
|
-
label: 'Form Templates',
|
|
156
|
-
link: '#',
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
label: 'Landing Page',
|
|
160
|
-
link: '#',
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
label: 'Figma Files',
|
|
164
|
-
link: '#',
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
label: 'Background Info',
|
|
168
|
-
link: '#',
|
|
169
|
-
},
|
|
170
|
-
],
|
|
171
|
-
},
|
|
172
|
-
itemProps: (item) => ({
|
|
173
|
-
label: item.title,
|
|
174
|
-
}),
|
|
175
|
-
fields: [
|
|
176
|
-
{
|
|
177
|
-
name: 'title',
|
|
178
|
-
label: 'Title',
|
|
179
|
-
component: 'text',
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
name: 'items',
|
|
183
|
-
label: 'Nav Items',
|
|
184
|
-
component: 'group-list',
|
|
185
|
-
itemProps: (item) => ({
|
|
186
|
-
label: item.label,
|
|
187
|
-
}),
|
|
188
|
-
fields: [
|
|
189
|
-
{
|
|
190
|
-
name: 'label',
|
|
191
|
-
label: 'Label',
|
|
192
|
-
component: 'text',
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
name: 'link',
|
|
196
|
-
label: 'Link',
|
|
197
|
-
component: 'text',
|
|
198
|
-
},
|
|
199
|
-
],
|
|
200
|
-
},
|
|
201
|
-
],
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const FOOTER_BLOCKS = {
|
|
205
|
-
nav: FooterNav,
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
export const FOOTER_FIELDS = [
|
|
209
|
-
{
|
|
210
|
-
label: 'Nav List',
|
|
211
|
-
name: 'navlist',
|
|
212
|
-
component: 'blocks',
|
|
213
|
-
itemProps: (item) => ({
|
|
214
|
-
label: item.title,
|
|
215
|
-
}),
|
|
216
|
-
templates: {
|
|
217
|
-
nav: footer_nav_template,
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
name: 'social',
|
|
222
|
-
label: 'Social Media',
|
|
223
|
-
component: 'group',
|
|
224
|
-
fields: [
|
|
225
|
-
{
|
|
226
|
-
name: 'facebook',
|
|
227
|
-
label: 'Facebook',
|
|
228
|
-
component: 'text',
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
name: 'twitter',
|
|
232
|
-
label: 'Twitter',
|
|
233
|
-
component: 'text',
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
name: 'instagram',
|
|
237
|
-
label: 'Instagram',
|
|
238
|
-
component: 'text',
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
name: 'github',
|
|
242
|
-
label: 'Github',
|
|
243
|
-
component: 'text',
|
|
244
|
-
},
|
|
245
|
-
],
|
|
246
|
-
},
|
|
247
|
-
]
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
Copyright 2021 Forestry.io Holdings, Inc.
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License.
|
|
5
|
-
You may obtain a copy of the License at
|
|
6
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software
|
|
8
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
-
See the License for the specific language governing permissions and
|
|
11
|
-
limitations under the License.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import * as React from 'react'
|
|
15
|
-
import { ThemeContext } from './theme'
|
|
16
|
-
import { ACTION_FIELDS, Actions } from './actions'
|
|
17
|
-
import { Section, SectionFields } from './section'
|
|
18
|
-
|
|
19
|
-
export const Hero = (data) => {
|
|
20
|
-
const theme = React.useContext(ThemeContext)
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<Section variant={data?.style?.color || 'blue'}>
|
|
24
|
-
<div className="w-full pt-20 lg:py-56 lg:text-left">
|
|
25
|
-
<div className="px-8 pb-20 lg:pb-0 lg:w-1/2 lg:px-12">
|
|
26
|
-
<div className="max-w-3xl mx-auto">
|
|
27
|
-
<h2 className="w-full mb-5 text-md font-bold tracking-wide title-font">
|
|
28
|
-
{data.tagline}
|
|
29
|
-
</h2>
|
|
30
|
-
<h3
|
|
31
|
-
className={`w-full relative mb-6 text-5xl font-extrabold tracking-normal text-left title-font`}
|
|
32
|
-
>
|
|
33
|
-
{data.style?.color === 'primary' ? (
|
|
34
|
-
<span
|
|
35
|
-
className={`bg-clip-text text-transparent bg-gradient-to-r from-gray-600 to-gray-800`}
|
|
36
|
-
style={{
|
|
37
|
-
textShadow: `0 0.5rem 3rem rgba(var(--color-rgb-${theme.color}-600),0.35)`,
|
|
38
|
-
boxDecorationBreak: 'clone',
|
|
39
|
-
WebkitBoxDecorationBreak: 'clone',
|
|
40
|
-
}}
|
|
41
|
-
>
|
|
42
|
-
{data.headline}
|
|
43
|
-
</span>
|
|
44
|
-
) : (
|
|
45
|
-
<span
|
|
46
|
-
className={`bg-clip-text text-transparent bg-gradient-to-r from-${theme.color}-400 to-${theme.color}-600`}
|
|
47
|
-
style={{
|
|
48
|
-
textShadow: `0 0.5rem 3rem rgba(var(--color-rgb-${theme.color}-600),0.35)`,
|
|
49
|
-
boxDecorationBreak: 'clone',
|
|
50
|
-
WebkitBoxDecorationBreak: 'clone',
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
53
|
-
{data.headline}
|
|
54
|
-
</span>
|
|
55
|
-
)}
|
|
56
|
-
</h3>
|
|
57
|
-
<p className="w-full max-w-xl mb-8 opacity-80 transition duration-150 ease-out text-left text-lg leading-relaxed lg:text-xl lg:leading-relaxed">
|
|
58
|
-
{data.paragraph}
|
|
59
|
-
</p>
|
|
60
|
-
<Actions actions={data.actions} />
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
<div className="relative w-full h-auto lg:absolute lg:inset-y-0 lg:right-0 lg:w-1/2 lg:h-full">
|
|
64
|
-
{data?.image && (
|
|
65
|
-
<img
|
|
66
|
-
className="lg:absolute lg:inset-0 w-full h-auto max-h-96 md:max-h-128 lg:max-h-full lg:h-full object-cover"
|
|
67
|
-
alt={data.image.alt}
|
|
68
|
-
src={data.image.src}
|
|
69
|
-
/>
|
|
70
|
-
)}
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
</Section>
|
|
74
|
-
)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export const IMAGE_FIELDS = [
|
|
78
|
-
{
|
|
79
|
-
name: 'src',
|
|
80
|
-
label: 'Image Source',
|
|
81
|
-
component: 'text',
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: 'alt',
|
|
85
|
-
label: 'Alt Text',
|
|
86
|
-
component: 'text',
|
|
87
|
-
},
|
|
88
|
-
]
|
|
89
|
-
|
|
90
|
-
export const hero_template = {
|
|
91
|
-
label: 'Hero',
|
|
92
|
-
defaultItem: {
|
|
93
|
-
tagline: 'TAGLINE ABOVE TEXT',
|
|
94
|
-
headline: 'This is a large display heading.',
|
|
95
|
-
text: 'Give your team a contextual, intuitive editing experience without sacrificing code quality.',
|
|
96
|
-
image: {
|
|
97
|
-
src: '/canal.jpg',
|
|
98
|
-
alt: 'Photo from Unsplash',
|
|
99
|
-
},
|
|
100
|
-
actions: [
|
|
101
|
-
{
|
|
102
|
-
label: 'Primary Action',
|
|
103
|
-
type: 'button',
|
|
104
|
-
icon: 'true',
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
label: 'Learn More',
|
|
108
|
-
type: 'link',
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
style: {
|
|
112
|
-
color: 'tint',
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
fields: [
|
|
116
|
-
{
|
|
117
|
-
name: '',
|
|
118
|
-
label: 'Text',
|
|
119
|
-
component: 'group',
|
|
120
|
-
fields: [...SectionFields],
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
name: 'image',
|
|
124
|
-
label: 'Image',
|
|
125
|
-
component: 'group',
|
|
126
|
-
fields: IMAGE_FIELDS,
|
|
127
|
-
},
|
|
128
|
-
...ACTION_FIELDS,
|
|
129
|
-
{
|
|
130
|
-
name: 'style',
|
|
131
|
-
label: 'Style',
|
|
132
|
-
component: 'group',
|
|
133
|
-
fields: [
|
|
134
|
-
{
|
|
135
|
-
name: 'color',
|
|
136
|
-
label: 'Color',
|
|
137
|
-
component: 'select',
|
|
138
|
-
options: [
|
|
139
|
-
{
|
|
140
|
-
label: 'Default',
|
|
141
|
-
value: 'default',
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
label: 'Tint',
|
|
145
|
-
value: 'tint',
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
label: 'Primary',
|
|
149
|
-
value: 'primary',
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
}
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
Copyright 2021 Forestry.io Holdings, Inc.
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License.
|
|
5
|
-
You may obtain a copy of the License at
|
|
6
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software
|
|
8
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
-
See the License for the specific language governing permissions and
|
|
11
|
-
limitations under the License.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import * as React from 'react'
|
|
15
|
-
import { ThemeContext } from './theme'
|
|
16
|
-
import {
|
|
17
|
-
BiCodeBlock,
|
|
18
|
-
BiLike,
|
|
19
|
-
BiMapAlt,
|
|
20
|
-
BiPalette,
|
|
21
|
-
BiPieChartAlt2,
|
|
22
|
-
BiPin,
|
|
23
|
-
BiShield,
|
|
24
|
-
BiSlider,
|
|
25
|
-
BiStore,
|
|
26
|
-
BiTennisBall,
|
|
27
|
-
BiTestTube,
|
|
28
|
-
BiTrophy,
|
|
29
|
-
BiUserCircle,
|
|
30
|
-
BiBeer,
|
|
31
|
-
BiChat,
|
|
32
|
-
BiCloud,
|
|
33
|
-
BiCoffeeTogo,
|
|
34
|
-
BiWorld,
|
|
35
|
-
} from 'react-icons/bi'
|
|
36
|
-
import { FiAperture } from 'react-icons/fi'
|
|
37
|
-
|
|
38
|
-
const iconOptions = {
|
|
39
|
-
BiCodeBlock: BiCodeBlock,
|
|
40
|
-
BiLike: BiLike,
|
|
41
|
-
BiMapAlt: BiMapAlt,
|
|
42
|
-
BiPalette: BiPalette,
|
|
43
|
-
BiPieChartAlt2: BiPieChartAlt2,
|
|
44
|
-
BiPin: BiPin,
|
|
45
|
-
BiShield: BiShield,
|
|
46
|
-
BiSlider: BiSlider,
|
|
47
|
-
BiStore: BiStore,
|
|
48
|
-
BiTennisBall: BiTennisBall,
|
|
49
|
-
BiTestTube: BiTestTube,
|
|
50
|
-
BiTrophy: BiTrophy,
|
|
51
|
-
BiUserCircle: BiUserCircle,
|
|
52
|
-
BiBeer: BiBeer,
|
|
53
|
-
BiChat: BiChat,
|
|
54
|
-
BiCloud: BiCloud,
|
|
55
|
-
BiCoffeeTogo: BiCoffeeTogo,
|
|
56
|
-
BiWorld: BiWorld,
|
|
57
|
-
FiAperture: FiAperture,
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export const Icon = ({ icon }) => {
|
|
61
|
-
const theme = React.useContext(ThemeContext)
|
|
62
|
-
const iconSize = icon?.size ? (icon.size === 'large' ? 14 : 9) : 14
|
|
63
|
-
|
|
64
|
-
const IconSVG = React.useMemo(() => {
|
|
65
|
-
return icon?.name ? iconOptions[icon?.name] : randomProperty(iconOptions)
|
|
66
|
-
}, [icon?.name])
|
|
67
|
-
|
|
68
|
-
const Component = React.useMemo(() => {
|
|
69
|
-
const iconColor =
|
|
70
|
-
icon?.color === 'primary' ? theme.color : icon?.color || 'blue'
|
|
71
|
-
|
|
72
|
-
if (!IconSVG) return null
|
|
73
|
-
if (icon?.style == 'circle') {
|
|
74
|
-
return (
|
|
75
|
-
<div
|
|
76
|
-
className={`relative z-10 inline-flex items-center justify-center flex-shrink-0 w-${iconSize} h-${iconSize} bg-${iconColor}-400 dark:bg-${iconColor}-500 text-${iconColor}-50 rounded-full`}
|
|
77
|
-
style={{
|
|
78
|
-
textShadow: '0 2px 5px rgba(0,0,0,0.1)',
|
|
79
|
-
boxShadow: `0 0.5rem 3rem 0px rgba(var(--color-rgb-${iconColor}-600),0.35)`,
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
<IconSVG
|
|
83
|
-
className={`w-${Math.max(iconSize - 5, 6)} h-${Math.max(
|
|
84
|
-
iconSize - 5,
|
|
85
|
-
6
|
|
86
|
-
)}`}
|
|
87
|
-
/>
|
|
88
|
-
</div>
|
|
89
|
-
)
|
|
90
|
-
} else {
|
|
91
|
-
return (
|
|
92
|
-
<IconSVG
|
|
93
|
-
className={`w-${iconSize} h-${iconSize} text-${iconColor}-400 dark:text-${iconColor}-500`}
|
|
94
|
-
style={{
|
|
95
|
-
filter: `drop-shadow(0 0.5rem 1rem rgba(var(--color-rgb-${iconColor}-600),0.4))`,
|
|
96
|
-
}}
|
|
97
|
-
/>
|
|
98
|
-
)
|
|
99
|
-
}
|
|
100
|
-
}, [icon?.style, IconSVG, icon?.color, theme.color])
|
|
101
|
-
|
|
102
|
-
return Component
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export const ICON_FIELDS = [
|
|
106
|
-
{
|
|
107
|
-
label: 'Icon',
|
|
108
|
-
name: 'icon',
|
|
109
|
-
component: 'group',
|
|
110
|
-
fields: [
|
|
111
|
-
{
|
|
112
|
-
name: 'color',
|
|
113
|
-
label: 'Color',
|
|
114
|
-
component: 'select',
|
|
115
|
-
options: [
|
|
116
|
-
{
|
|
117
|
-
label: 'Primary (Theme)',
|
|
118
|
-
value: 'primary',
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
label: 'Blue',
|
|
122
|
-
value: 'blue',
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
label: 'Teal',
|
|
126
|
-
value: 'teal',
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
label: 'Green',
|
|
130
|
-
value: 'green',
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
label: 'Red',
|
|
134
|
-
value: 'red',
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
label: 'Pink',
|
|
138
|
-
value: 'pink',
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
label: 'Purple',
|
|
142
|
-
value: 'purple',
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
label: 'Orange',
|
|
146
|
-
value: 'orange',
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
label: 'Yellow',
|
|
150
|
-
value: 'yellow',
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
name: 'name',
|
|
156
|
-
label: 'Icon',
|
|
157
|
-
component: 'select',
|
|
158
|
-
options: [
|
|
159
|
-
{
|
|
160
|
-
label: 'Random',
|
|
161
|
-
value: '',
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
label: 'Aperture',
|
|
165
|
-
value: 'FiAperture',
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
label: 'Code Block',
|
|
169
|
-
value: 'BiCodeBlock',
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
label: 'Like',
|
|
173
|
-
value: 'BiLike',
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
label: 'Map',
|
|
177
|
-
value: 'BiMapAlt',
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
label: 'Palette',
|
|
181
|
-
value: 'BiPalette',
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
label: 'Pie Chart',
|
|
185
|
-
value: 'BiPieChartAlt2',
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
label: 'Pin',
|
|
189
|
-
value: 'BiPin',
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
label: 'Shield',
|
|
193
|
-
value: 'BiShield',
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
label: 'Setting Sliders',
|
|
197
|
-
value: 'BiSlider',
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
label: 'Store',
|
|
201
|
-
value: 'BiStore',
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
label: 'Tennis Ball',
|
|
205
|
-
value: 'BiTennisBall',
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
label: 'Test Tube',
|
|
209
|
-
value: 'BiTestTube',
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
label: 'Trophy',
|
|
213
|
-
value: 'BiTrophy',
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
label: 'User',
|
|
217
|
-
value: 'BiUserCircle',
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
label: 'Beer',
|
|
221
|
-
value: 'BiBeer',
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
label: 'Chat',
|
|
225
|
-
value: 'BiChat',
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
label: 'Cloud',
|
|
229
|
-
value: 'BiCloud',
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
label: 'Coffee',
|
|
233
|
-
value: 'BiCoffeeTogo',
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
label: 'World',
|
|
237
|
-
value: 'BiWorld',
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
name: 'style',
|
|
243
|
-
label: 'Style',
|
|
244
|
-
component: 'radio-group',
|
|
245
|
-
variant: 'button',
|
|
246
|
-
options: [
|
|
247
|
-
{
|
|
248
|
-
label: 'Circle',
|
|
249
|
-
value: 'circle',
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
label: 'Float',
|
|
253
|
-
value: 'float',
|
|
254
|
-
},
|
|
255
|
-
],
|
|
256
|
-
},
|
|
257
|
-
],
|
|
258
|
-
},
|
|
259
|
-
]
|
|
260
|
-
|
|
261
|
-
const randomProperty = (obj) => {
|
|
262
|
-
var keys = Object.keys(obj)
|
|
263
|
-
return obj[keys[(keys.length * Math.random()) << 0]]
|
|
264
|
-
}
|