forked from krakenjs/zoid-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponent.jsx
99 lines (85 loc) · 2.83 KB
/
component.jsx
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
/* @flow */
/** @jsx node */
import { create } from 'zoid/src';
import { node, dom } from 'jsx-pragmatic/src';
export let LoginZoidComponent = create({
tag: 'login-component',
dimensions: {
width: '300px',
height: '150px'
},
url: ({ props }) => {
return {
demo: './login.htm',
production: 'https://my-site.com/login',
test: 'mock://www.my-site.com/base/test/windows/login/index.htm',
}[props.env];
},
props: {
env: {
type: 'string',
default: () => 'production'
},
prefilledEmail: {
type: 'string'
},
onLogin: {
type: 'function'
}
},
defaultContext: __DEFAULT_CONTEXT__,
prerenderTemplate({ doc } : { doc : Document }) : HTMLElement {
return (
<html>
<head>
<style>
{`
html, body {
width: 100%;
height: 100%;
overflow: hidden;
top: 0;
left: 0;
margin: 0;
text-align: center;
}
.spinner {
position: absolute;
max-height: 60vmin;
max-width: 60vmin;
height: 40px;
width: 40px;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
z-index: 10;
}
.spinner .loader {
height: 100%;
width: 100%;
box-sizing: border-box;
border: 3px solid rgba(0, 0, 0, .2);
border-top-color: rgba(33, 128, 192, 0.8);
border-radius: 100%;
animation: rotation .7s infinite linear;
}
@keyframes rotation {
from {
transform: rotate(0deg)
}
to {
transform: rotate(359deg)
}
}
`}
</style>
</head>
<body>
<div class="spinner">
<div id="loader" class="loader"></div>
</div>
</body>
</html>
).render(dom({ doc }));
}
});