-
Notifications
You must be signed in to change notification settings - Fork 174
/
Copy pathnext.tsx
349 lines (330 loc) · 10.6 KB
/
next.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
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
import { Popover, Transition } from '@headlessui/react'
import React from 'react'
import { Fragment } from 'react'
import { CookieConsent, getCookieConsentValue } from 'react-cookie-consent'
import { useBrowserEnv } from '../util/use-env'
const mainNavigation = [
{ name: ' ', href: '#' },
{ name: ' ', href: '#' },
{ name: ' ', href: '#' },
{ name: ' ', href: '#' },
{ name: ' ', href: '#' },
{ name: ' ', href: '#' },
{ name: 'Github', href: 'https://github.com/concrete-utopia/utopia' },
{ name: 'Discord', href: 'https://discord.gg/NEEnPKCgzC' },
{
name: 'Play with Utopia',
href: 'https://utopia.app/p/36ae27be-welcome-to-utopia',
primary: true,
},
]
export function Menu() {
return (
<Popover className='flex-grow'>
{({ open }) => (
<>
<div className='relative px-4 sm:px-6 lg:px-8 flex-grow'>
<nav className='relative flex items-center justify-between sm:h-10 max-w-6xl m-auto font-body'>
<HostedImage className='h-8 w-auto sm:h-10' src='/pyramid_small.png' />
{mainNavigation.map((item, index) => (
<a
key={`main-nav-${index}`}
href={item.href}
className='hidden md:block font-body text-lg'
style={{
color: item.primary === true ? '#FFFFFF' : '#383C4A',
backgroundColor: item.primary === true ? '#181818' : '#FFFFFF',
padding: '6px 20px',
borderRadius: 4,
}}
onMouseDown={() =>
gtag('event', 'navigate', { category: 'links', label: item.href, value: 1 })
}
>
{item.name}
</a>
))}
<div className='-mr-2 flex items-center md:hidden'>
<Popover.Button className='bg-white rounded-md p-2 inline-flex items-center justify-center text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500'>
<span className='sr-only'>Open main menu</span>
</Popover.Button>
</div>
</nav>
</div>
<Transition
show={open}
as={Fragment}
enter='duration-150 ease-out'
enterFrom='opacity-0 scale-95'
enterTo='opacity-100 scale-100'
leave='duration-100 ease-in'
leaveFrom='opacity-100 scale-100'
leaveTo='opacity-0 scale-95'
>
<Popover.Panel
focus
static
className='absolute top-0 inset-x-0 p-2 transition transform origin-top-right md:hidden'
>
<div className='rounded-lg shadow-md bg-white ring-1 ring-black ring-opacity-5 overflow-hidden'>
<div className='px-5 pt-4 flex items-center justify-between'>
<div>
<HostedImage className='h-8 w-auto' src='/pyramid_small.png' alt='' />
</div>
<div className='-mr-2'>
<Popover.Button className='bg-white rounded-md p-2 inline-flex items-center justify-center text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500'>
<span className='sr-only'>Close main menu</span>
</Popover.Button>
</div>
</div>
<div className='px-2 pt-2 pb-3 space-y-1'>
{mainNavigation.map((item, index) => (
<a
key={`panel-nav-${index}`}
href={item.href}
className='block px-3 py-2 rounded-md text-base font-body text-gray-700 hover:text-gray-900 hover:bg-gray-50'
>
{item.name}
</a>
))}
</div>
<a
href='#'
className='block w-full px-5 py-3 text-center font-body text-indigo-600 bg-gray-50 hover:bg-gray-100'
>
Log in
</a>
</div>
</Popover.Panel>
</Transition>
</>
)}
</Popover>
)
}
export const MainTitle = React.memo(({ children }: { children: React.ReactNode }) => {
return (
<h1
className='md:text-6xl text-3xl leading-normal tracking-tight font-headline'
style={{
color: '#383C4A',
}}
>
{children}
</h1>
)
})
MainTitle.displayName = 'MainTitle'
export const Paragraph = React.memo(({ children }: { children: React.ReactNode }) => {
return (
<div
className='md:text-xl text-base md:leading-8 leading-6 font-body pb-4 md:pb-10'
style={{
color: '#383C4A',
}}
>
{children}
</div>
)
})
Paragraph.displayName = 'Paragraph'
export const EyeButton = () => (
<div
style={{
borderRadius: '50%',
height: 17,
width: 17,
background: 'white',
border: '1px solid #383C4A',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<div
style={{
borderRadius: '50%',
height: 8,
width: 8,
background: '#383C4A',
}}
>
<div
style={{
borderRadius: '50%',
height: 2,
width: 2,
background: 'white',
position: 'relative',
left: 4,
top: 3,
display: 'block',
}}
/>
</div>
</div>
)
export const GhostBrowser = (props: {
className?: string
title?: string
children: React.ReactNode
}) => (
<div
className={props.className}
style={{
display: 'flex',
fontFamily: 'Moderat-Regular',
fontSize: 11,
flexDirection: 'column',
color: 'white',
border: '1px solid #383C4A',
borderRadius: 8,
background: '#FFFFFF',
overflow: 'hidden',
}}
>
<div
style={{
display: 'flex',
alignItems: 'center',
borderBottom: '1px solid #383C4A',
paddingLeft: 8,
paddingRight: 8,
height: 32,
minHeight: 32,
}}
>
<div
style={{
display: 'flex',
alignItems: 'center',
flexGrow: 1,
gap: 6,
}}
>
<EyeButton />
<EyeButton />
</div>
<div style={{ cursor: 'grab' }}>{props.title}</div>
</div>
<div style={{}}>{props.children}</div>
</div>
)
const contactUsNavigation = [
{ name: 'Play with Utopia', href: 'https://utopia.app/p/36ae27be-welcome-to-utopia' },
{ name: 'Join our Discord', href: 'https://discord.gg/NEEnPKCgzC' },
{ name: 'Check us on Github', href: 'https://github.com/concrete-utopia/utopia' },
{ name: 'Privacy Policy', href: '/policies#privacy-policy' },
{ name: 'Terms and Conditions', href: '/policies' },
]
export const ContactUs = () => (
<>
<div
className='max-w-2xl h-52 md:h-36 mx-auto mb-6 font-body md:text-lg text-sm text-center'
style={{
position: 'relative',
border: '1px solid black',
padding: 16,
}}
>
<div
style={{
position: 'absolute',
left: 10,
right: -10,
top: 10,
bottom: -10,
border: '1px solid black',
background: 'white',
padding: 14,
display: 'flex',
flexDirection: 'column',
}}
>
<span>
Stay in touch. We’ll send you a long-form email once or twice a month <br />
(and only when we have enough new development to write about!)
</span>
<BasicEmailSignup />
</div>
</div>
<div className='font-body md:text-lg text-sm flex justify-center items-center'>
{contactUsNavigation.map((item, index) => (
<a
key={`contact-us-nav-${index}`}
href={item.href}
className='block px-6 py-2 rounded-md text-body hover:text-gray-900 hover:bg-gray-50 text-center'
onMouseDown={() =>
gtag('event', 'navigate', { category: 'links', label: item.href, value: 1 })
}
>
{item.name}
</a>
))}
</div>
</>
)
declare function gtag(...args: any): void
function enableCookies() {
gtag('consent', 'update', {
analytics_storage: 'granted',
})
}
export const CookieConsentBar = () => {
if (getCookieConsentValue() === 'true') {
enableCookies()
}
return (
<CookieConsent
location='bottom'
style={{ background: '#383C4A', fontSize: '13px' }}
buttonStyle={{
color: '#383C4A',
fontSize: '13px',
borderRadius: 5,
backgroundColor: '#00FC00',
}}
// onAccept={enableCookies}
>
This website uses cookies to enhance the user experience.
</CookieConsent>
)
}
type HostedImageProps = React.DetailedHTMLProps<
React.ImgHTMLAttributes<HTMLImageElement>,
HTMLImageElement
> & { src: string }
export function HostedImage(props: HostedImageProps) {
const env = useBrowserEnv()
if (env == null) {
return null
}
return <img {...props} src={`${env.UTOPIA_CDN_URL}${props.src}`} />
}
export const BasicEmailSignup = React.memo(() => {
return (
<div
dangerouslySetInnerHTML={{
__html: `
<!-- Begin Mailchimp Signup Form -->
<link href="//cdn-images.mailchimp.com/embedcode/horizontal-slim-10_7.css" rel="stylesheet" type="text/css">
<div id="mc_embed_signup">
<form action="https://app.us6.list-manage.com/subscribe/post?u=45910e347a2446abcf18e9b45&id=30e94ed0b5" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<label for="mce-EMAIL" className='font-normal'></label>
<input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
<!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_45910e347a2446abcf18e9b45_30e94ed0b5" tabindex="-1" value=""></div>
<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
</div>
</form>
</div>
<!--End mc_embed_signup-->
`,
}}
/>
)
})
export function Video({ src }: { src: string }) {
return <video controls autoPlay loop muted playsInline preload={'auto'} src={src} />
}