-
-
Notifications
You must be signed in to change notification settings - Fork 8k
/
index.tsx
144 lines (139 loc) · 3.72 KB
/
index.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
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// Should we translate theme-fallback?
/* eslint-disable @docusaurus/no-untranslated-text */
import React from 'react';
import type {LoadingComponentProps} from 'react-loadable';
export default function Loading({
error,
retry,
pastDelay,
}: LoadingComponentProps): JSX.Element | null {
if (error) {
return (
<div
style={{
textAlign: 'center',
color: '#fff',
backgroundColor: '#fa383e',
borderColor: '#fa383e',
borderStyle: 'solid',
borderRadius: '0.25rem',
borderWidth: '1px',
boxSizing: 'border-box',
display: 'block',
padding: '1rem',
flex: '0 0 50%',
marginLeft: '25%',
marginRight: '25%',
marginTop: '5rem',
maxWidth: '50%',
width: '100%',
}}>
<p>{error.message}</p>
<div>
<button type="button" onClick={retry}>
Retry
</button>
</div>
</div>
);
}
if (pastDelay) {
return (
<div
style={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
height: '100vh',
}}>
<svg
id="loader"
style={{
width: 128,
height: 110,
position: 'absolute',
top: 'calc(100vh - 64%)',
}}
viewBox="0 0 45 45"
xmlns="http://www.w3.org/2000/svg"
stroke="#61dafb">
<g
fill="none"
fillRule="evenodd"
transform="translate(1 1)"
strokeWidth="2">
<circle cx="22" cy="22" r="6" strokeOpacity="0">
<animate
attributeName="r"
begin="1.5s"
dur="3s"
values="6;22"
calcMode="linear"
repeatCount="indefinite"
/>
<animate
attributeName="stroke-opacity"
begin="1.5s"
dur="3s"
values="1;0"
calcMode="linear"
repeatCount="indefinite"
/>
<animate
attributeName="stroke-width"
begin="1.5s"
dur="3s"
values="2;0"
calcMode="linear"
repeatCount="indefinite"
/>
</circle>
<circle cx="22" cy="22" r="6" strokeOpacity="0">
<animate
attributeName="r"
begin="3s"
dur="3s"
values="6;22"
calcMode="linear"
repeatCount="indefinite"
/>
<animate
attributeName="stroke-opacity"
begin="3s"
dur="3s"
values="1;0"
calcMode="linear"
repeatCount="indefinite"
/>
<animate
attributeName="stroke-width"
begin="3s"
dur="3s"
values="2;0"
calcMode="linear"
repeatCount="indefinite"
/>
</circle>
<circle cx="22" cy="22" r="8">
<animate
attributeName="r"
begin="0s"
dur="1.5s"
values="6;1;2;3;4;5;6"
calcMode="linear"
repeatCount="indefinite"
/>
</circle>
</g>
</svg>
</div>
);
}
return null;
}