diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/ui/AppLoader.js | 15 | ||||
-rw-r--r-- | src/components/ui/AppLoader/index.js | 69 | ||||
-rw-r--r-- | src/components/ui/AppLoader/styles.js | 16 | ||||
-rw-r--r-- | src/components/ui/FullscreenLoader/index.js | 26 | ||||
-rw-r--r-- | src/components/ui/FullscreenLoader/styles.js | 23 | ||||
-rw-r--r-- | src/components/ui/WebviewLoader/index.js | 9 |
6 files changed, 143 insertions, 15 deletions
diff --git a/src/components/ui/AppLoader.js b/src/components/ui/AppLoader.js deleted file mode 100644 index ac3cdcb05..000000000 --- a/src/components/ui/AppLoader.js +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | import React from 'react'; | ||
2 | |||
3 | import Appear from '../../components/ui/effects/Appear'; | ||
4 | import Loader from '../../components/ui/Loader'; | ||
5 | |||
6 | export default function () { | ||
7 | return ( | ||
8 | <div className="app-loader"> | ||
9 | <Appear> | ||
10 | <h1 className="app-loader__title">Franz</h1> | ||
11 | <Loader color="#FFF" /> | ||
12 | </Appear> | ||
13 | </div> | ||
14 | ); | ||
15 | } | ||
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 @@ | |||
1 | import React, { Component } from 'react'; | ||
2 | import PropTypes from 'prop-types'; | ||
3 | import injectSheet from 'react-jss'; | ||
4 | import classnames from 'classnames'; | ||
5 | |||
6 | import FullscreenLoader from '../FullscreenLoader'; | ||
7 | import { shuffleArray } from '../../../helpers/array-helpers'; | ||
8 | |||
9 | import styles from './styles'; | ||
10 | |||
11 | const 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 | |||
22 | export 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 | |||
diff --git a/src/components/ui/AppLoader/styles.js b/src/components/ui/AppLoader/styles.js new file mode 100644 index 000000000..755a56b40 --- /dev/null +++ b/src/components/ui/AppLoader/styles.js | |||
@@ -0,0 +1,16 @@ | |||
1 | export default { | ||
2 | component: { | ||
3 | color: '#FFF', | ||
4 | }, | ||
5 | slogan: { | ||
6 | display: 'block', | ||
7 | opacity: 0, | ||
8 | transition: 'opacity 1s ease', | ||
9 | position: 'absolute', | ||
10 | textAlign: 'center', | ||
11 | width: '100%', | ||
12 | }, | ||
13 | visible: { | ||
14 | opacity: 1, | ||
15 | }, | ||
16 | }; | ||
diff --git a/src/components/ui/FullscreenLoader/index.js b/src/components/ui/FullscreenLoader/index.js new file mode 100644 index 000000000..bff5189c5 --- /dev/null +++ b/src/components/ui/FullscreenLoader/index.js | |||
@@ -0,0 +1,26 @@ | |||
1 | import React from 'react'; | ||
2 | import injectSheet from 'react-jss'; | ||
3 | import classnames from 'classnames'; | ||
4 | |||
5 | import Loader from '../Loader'; | ||
6 | |||
7 | import styles from './styles'; | ||
8 | |||
9 | export default injectSheet(styles)(({ classes, className, title, children }) => ( | ||
10 | <div className={classes.wrapper}> | ||
11 | <div | ||
12 | className={classnames({ | ||
13 | [`${classes.component}`]: true, | ||
14 | [`${className}`]: className, | ||
15 | })} | ||
16 | > | ||
17 | <h1 className={classes.title}>{title}</h1> | ||
18 | <Loader color="#FFF" /> | ||
19 | {children && ( | ||
20 | <div className={classes.content}> | ||
21 | {children} | ||
22 | </div> | ||
23 | )} | ||
24 | </div> | ||
25 | </div> | ||
26 | )); | ||
diff --git a/src/components/ui/FullscreenLoader/styles.js b/src/components/ui/FullscreenLoader/styles.js new file mode 100644 index 000000000..64d24e4ce --- /dev/null +++ b/src/components/ui/FullscreenLoader/styles.js | |||
@@ -0,0 +1,23 @@ | |||
1 | export default { | ||
2 | wrapper: { | ||
3 | display: 'flex', | ||
4 | alignItems: 'center', | ||
5 | position: 'absolute', | ||
6 | width: '100%', | ||
7 | }, | ||
8 | component: { | ||
9 | width: '100%', | ||
10 | display: 'flex', | ||
11 | flexDirection: 'column', | ||
12 | alignItems: 'center', | ||
13 | textAlign: 'center', | ||
14 | height: 'auto', | ||
15 | }, | ||
16 | title: { | ||
17 | fontSize: 35, | ||
18 | }, | ||
19 | content: { | ||
20 | marginTop: 20, | ||
21 | width: '100%', | ||
22 | }, | ||
23 | }; | ||
diff --git a/src/components/ui/WebviewLoader/index.js b/src/components/ui/WebviewLoader/index.js new file mode 100644 index 000000000..eff4dc3d7 --- /dev/null +++ b/src/components/ui/WebviewLoader/index.js | |||
@@ -0,0 +1,9 @@ | |||
1 | import React from 'react'; | ||
2 | |||
3 | import FullscreenLoader from '../FullscreenLoader'; | ||
4 | |||
5 | export default ({ name }) => ( | ||
6 | <FullscreenLoader | ||
7 | title={`Loading ${name}`} | ||
8 | /> | ||
9 | ); | ||