aboutsummaryrefslogtreecommitdiffstats
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.js70
1 files changed, 70 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..61053f6d1
--- /dev/null
+++ b/src/components/ui/AppLoader/index.js
@@ -0,0 +1,70 @@
1import React, { Component } from 'react';
2import PropTypes from 'prop-types';
3import injectSheet, { withTheme } 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) @withTheme class AppLoader extends Component {
23 static propTypes = {
24 classes: PropTypes.object.isRequired,
25 theme: PropTypes.object.isRequired,
26 }
27
28 state = {
29 step: 0,
30 }
31
32 interval = null;
33
34 componentDidMount() {
35 this.interval = setInterval(() => {
36 this.setState(prevState => ({
37 step: prevState.step === textList.length - 1 ? 0 : prevState.step + 1,
38 }));
39 }, 2500);
40 }
41
42 componentWillUnmount() {
43 clearInterval(this.interval);
44 }
45
46 render() {
47 const { classes, theme } = this.props;
48 const { step } = this.state;
49
50 return (
51 <FullscreenLoader
52 title="Franz"
53 className={classes.component}
54 spinnerColor={theme.colorAppLoaderSpinner}
55 >
56 {textList.map((text, i) => (
57 <span
58 key={text}
59 className={classnames({
60 [`${classes.slogan}`]: true,
61 [`${classes.visible}`]: step === i,
62 })}
63 >
64 {text}
65 </span>
66 ))}
67 </FullscreenLoader>
68 );
69 }
70}