UNPKG

8.58 kBJavaScriptView Raw
1import _mergeJSXProps from 'babel-helper-vue-jsx-merge-props';
2
3var uid = (function () {
4 return Math.random().toString(36).substring(2);
5});
6
7var ContentLoader = {
8 name: 'ContentLoader',
9 functional: true,
10 props: {
11 width: {
12 type: Number,
13 default: 400
14 },
15 height: {
16 type: Number,
17 default: 130
18 },
19 speed: {
20 type: Number,
21 default: 2
22 },
23 preserveAspectRatio: {
24 type: String,
25 default: 'xMidYMid meet'
26 },
27 primaryColor: {
28 type: String,
29 default: '#f9f9f9'
30 },
31 secondaryColor: {
32 type: String,
33 default: '#ecebeb'
34 },
35 uniqueKey: {
36 type: String
37 },
38 animate: {
39 type: Boolean,
40 default: true
41 }
42 },
43 render: function render(h, _ref) {
44 var props = _ref.props,
45 data = _ref.data,
46 children = _ref.children;
47 var idClip = props.uniqueKey ? "".concat(props.uniqueKey, "-idClip") : uid();
48 var idGradient = props.uniqueKey ? "".concat(props.uniqueKey, "-idGradient") : uid();
49 return h("svg", _mergeJSXProps([data, {
50 attrs: {
51 viewBox: "0 0 ".concat(props.width, " ").concat(props.height),
52 version: "1.1",
53 preserveAspectRatio: props.preserveAspectRatio
54 }
55 }]), [h("rect", {
56 style: {
57 fill: "url(#".concat(idGradient, ")")
58 },
59 attrs: {
60 "clip-path": "url(#".concat(idClip, ")"),
61 x: "0",
62 y: "0",
63 width: props.width,
64 height: props.height
65 }
66 }), h("defs", [h("clipPath", {
67 attrs: {
68 id: idClip
69 }
70 }, [children || h("rect", {
71 attrs: {
72 x: "0",
73 y: "0",
74 rx: "5",
75 ry: "5",
76 width: props.width,
77 height: props.height
78 }
79 })]), h("linearGradient", {
80 attrs: {
81 id: idGradient
82 }
83 }, [h("stop", {
84 attrs: {
85 offset: "0%",
86 "stop-color": props.primaryColor
87 }
88 }, [props.animate ? h("animate", {
89 attrs: {
90 attributeName: "offset",
91 values: "-2; 1",
92 dur: "".concat(props.speed, "s"),
93 repeatCount: "indefinite"
94 }
95 }) : null]), h("stop", {
96 attrs: {
97 offset: "50%",
98 "stop-color": props.secondaryColor
99 }
100 }, [props.animate ? h("animate", {
101 attrs: {
102 attributeName: "offset",
103 values: "-1.5; 1.5",
104 dur: "".concat(props.speed, "s"),
105 repeatCount: "indefinite"
106 }
107 }) : null]), h("stop", {
108 attrs: {
109 offset: "100%",
110 "stop-color": props.primaryColor
111 }
112 }, [props.animate ? h("animate", {
113 attrs: {
114 attributeName: "offset",
115 values: "-1; 2",
116 dur: "".concat(props.speed, "s"),
117 repeatCount: "indefinite"
118 }
119 }) : null])])])]);
120 }
121};
122
123var BulletListLoader = {
124 name: 'BulletListLoader',
125 functional: true,
126 render: function render(h, _ref) {
127 var data = _ref.data;
128 return h(ContentLoader, data, [h("circle", {
129 attrs: {
130 cx: "10",
131 cy: "20",
132 r: "8"
133 }
134 }), h("rect", {
135 attrs: {
136 x: "25",
137 y: "15",
138 rx: "5",
139 ry: "5",
140 width: "220",
141 height: "10"
142 }
143 }), h("circle", {
144 attrs: {
145 cx: "10",
146 cy: "50",
147 r: "8"
148 }
149 }), h("rect", {
150 attrs: {
151 x: "25",
152 y: "45",
153 rx: "5",
154 ry: "5",
155 width: "220",
156 height: "10"
157 }
158 }), h("circle", {
159 attrs: {
160 cx: "10",
161 cy: "80",
162 r: "8"
163 }
164 }), h("rect", {
165 attrs: {
166 x: "25",
167 y: "75",
168 rx: "5",
169 ry: "5",
170 width: "220",
171 height: "10"
172 }
173 }), h("circle", {
174 attrs: {
175 cx: "10",
176 cy: "110",
177 r: "8"
178 }
179 }), h("rect", {
180 attrs: {
181 x: "25",
182 y: "105",
183 rx: "5",
184 ry: "5",
185 width: "220",
186 height: "10"
187 }
188 })]);
189 }
190};
191
192var CodeLoader = {
193 name: 'CodeLoader',
194 functional: true,
195 render: function render(h, _ref) {
196 var data = _ref.data;
197 return h(ContentLoader, data, [h("rect", {
198 attrs: {
199 x: "0",
200 y: "0",
201 rx: "3",
202 ry: "3",
203 width: "70",
204 height: "10"
205 }
206 }), h("rect", {
207 attrs: {
208 x: "80",
209 y: "0",
210 rx: "3",
211 ry: "3",
212 width: "100",
213 height: "10"
214 }
215 }), h("rect", {
216 attrs: {
217 x: "190",
218 y: "0",
219 rx: "3",
220 ry: "3",
221 width: "10",
222 height: "10"
223 }
224 }), h("rect", {
225 attrs: {
226 x: "15",
227 y: "20",
228 rx: "3",
229 ry: "3",
230 width: "130",
231 height: "10"
232 }
233 }), h("rect", {
234 attrs: {
235 x: "155",
236 y: "20",
237 rx: "3",
238 ry: "3",
239 width: "130",
240 height: "10"
241 }
242 }), h("rect", {
243 attrs: {
244 x: "15",
245 y: "40",
246 rx: "3",
247 ry: "3",
248 width: "90",
249 height: "10"
250 }
251 }), h("rect", {
252 attrs: {
253 x: "115",
254 y: "40",
255 rx: "3",
256 ry: "3",
257 width: "60",
258 height: "10"
259 }
260 }), h("rect", {
261 attrs: {
262 x: "185",
263 y: "40",
264 rx: "3",
265 ry: "3",
266 width: "60",
267 height: "10"
268 }
269 }), h("rect", {
270 attrs: {
271 x: "0",
272 y: "60",
273 rx: "3",
274 ry: "3",
275 width: "30",
276 height: "10"
277 }
278 })]);
279 }
280};
281
282var FacebookLoader = {
283 name: 'FacebookLoader',
284 functional: true,
285 render: function render(h, _ref) {
286 var data = _ref.data;
287 return h(ContentLoader, data, [h("rect", {
288 attrs: {
289 x: "70",
290 y: "15",
291 rx: "4",
292 ry: "4",
293 width: "117",
294 height: "6.4"
295 }
296 }), h("rect", {
297 attrs: {
298 x: "70",
299 y: "35",
300 rx: "3",
301 ry: "3",
302 width: "85",
303 height: "6.4"
304 }
305 }), h("rect", {
306 attrs: {
307 x: "0",
308 y: "80",
309 rx: "3",
310 ry: "3",
311 width: "350",
312 height: "6.4"
313 }
314 }), h("rect", {
315 attrs: {
316 x: "0",
317 y: "100",
318 rx: "3",
319 ry: "3",
320 width: "380",
321 height: "6.4"
322 }
323 }), h("rect", {
324 attrs: {
325 x: "0",
326 y: "120",
327 rx: "3",
328 ry: "3",
329 width: "201",
330 height: "6.4"
331 }
332 }), h("circle", {
333 attrs: {
334 cx: "30",
335 cy: "30",
336 r: "30"
337 }
338 })]);
339 }
340};
341
342var ListLoader = {
343 name: 'ListLoader',
344 functional: true,
345 render: function render(h, _ref) {
346 var data = _ref.data;
347 return h(ContentLoader, data, [h("rect", {
348 attrs: {
349 x: "0",
350 y: "0",
351 rx: "3",
352 ry: "3",
353 width: "250",
354 height: "10"
355 }
356 }), h("rect", {
357 attrs: {
358 x: "20",
359 y: "20",
360 rx: "3",
361 ry: "3",
362 width: "220",
363 height: "10"
364 }
365 }), h("rect", {
366 attrs: {
367 x: "20",
368 y: "40",
369 rx: "3",
370 ry: "3",
371 width: "170",
372 height: "10"
373 }
374 }), h("rect", {
375 attrs: {
376 x: "0",
377 y: "60",
378 rx: "3",
379 ry: "3",
380 width: "250",
381 height: "10"
382 }
383 }), h("rect", {
384 attrs: {
385 x: "20",
386 y: "80",
387 rx: "3",
388 ry: "3",
389 width: "200",
390 height: "10"
391 }
392 }), h("rect", {
393 attrs: {
394 x: "20",
395 y: "100",
396 rx: "3",
397 ry: "3",
398 width: "80",
399 height: "10"
400 }
401 })]);
402 }
403};
404
405var InstagramLoader = {
406 name: 'InstagramLoader',
407 functional: true,
408 render: function render(h, _ref) {
409 var data = _ref.data;
410 return h(ContentLoader, _mergeJSXProps([data, {
411 attrs: {
412 height: 480
413 }
414 }]), [h("circle", {
415 attrs: {
416 cx: "30",
417 cy: "30",
418 r: "30"
419 }
420 }), h("rect", {
421 attrs: {
422 x: "75",
423 y: "13",
424 rx: "4",
425 ry: "4",
426 width: "100",
427 height: "13"
428 }
429 }), h("rect", {
430 attrs: {
431 x: "75",
432 y: "37",
433 rx: "4",
434 ry: "4",
435 width: "50",
436 height: "8"
437 }
438 }), h("rect", {
439 attrs: {
440 x: "0",
441 y: "70",
442 rx: "5",
443 ry: "5",
444 width: "400",
445 height: "400"
446 }
447 })]);
448 }
449};
450
451export { ContentLoader, BulletListLoader, CodeLoader, FacebookLoader, ListLoader, InstagramLoader };