summaryrefslogtreecommitdiffstats
path: root/src/components/ui/AppLoader/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/ui/AppLoader/index.js')
-rw-r--r--src/components/ui/AppLoader/index.js69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/components/ui/AppLoader/index.js b/src/components/ui/AppLoader/index.js
new file mode 100644
index 000000000..61f97d4f9
--- /dev/null
+++ b/src/components/ui/AppLoader/index.js
@@ -0,0 +1,69 @@
1import React, { Component } from 'react';
2import PropTypes from 'prop-types';
3import injectSheet from 'react-jss';
4import classnames from 'classnames';
5
6import FullscreenLoader from '../FullscreenLoader';
7import { shuffleArray } from '../../../helpers/array-helpers';
8
9import styles from './styles';
10
11const textList = shuffleArray([
12 'Looking for Sisi',
13 'Contacting the herald',
14 'Saddling the unicorn',
15 'Learning the Waltz',
16 'Visiting Horst & Grete',
17 'Twisting my moustache',
18 'Playing the trumpet',
19 'Traveling through space & time',
20]);
21
22export default @injectSheet(styles) class AppLoader extends Component {
23 static propTypes = {
24 classes: PropTypes.object.isRequired,
25 }
26
27 state = {
28 step: 0,
29 }
30
31 componentDidMount() {
32 this.interval = setInterval(() => {
33 this.setState({
34 step: this.state.step === textList.length - 1 ? 0 : this.state.step + 1,
35 });
36 }, 2500);
37 }
38
39 componentWillUnmount() {
40 clearInterval(this.interval);
41 }
42
43 interval = null;
44
45 render() {
46 const { classes } = this.props;
47 const { step } = this.state;
48
49 return (
50 <FullscreenLoader
51 title="Franz"
52 className={classes.component}
53 >
54 {textList.map((text, i) => (
55 <span
56 key={i}
57 className={classnames({
58 [`${classes.slogan}`]: true,
59 [`${classes.visible}`]: step === i,
60 })}
61 >
62 {text}
63 </span>
64 ))}
65 </FullscreenLoader>
66 );
67 }
68}
69