diff options
author | 2018-12-11 11:58:42 +0100 | |
---|---|---|
committer | 2018-12-11 11:58:42 +0100 | |
commit | a73e183108104192ae17c75a5a60eb3075464476 (patch) | |
tree | bcedf65522520405ab38f2baeac009f563aa5158 /src/components | |
parent | fix countdown state (diff) | |
download | ferdium-app-a73e183108104192ae17c75a5a60eb3075464476.tar.gz ferdium-app-a73e183108104192ae17c75a5a60eb3075464476.tar.zst ferdium-app-a73e183108104192ae17c75a5a60eb3075464476.zip |
Improve webview loader
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/services/content/ServiceWebview.js | 4 | ||||
-rw-r--r-- | src/components/ui/WebviewLoader/index.js | 28 | ||||
-rw-r--r-- | src/components/ui/WebviewLoader/styles.js | 9 |
3 files changed, 29 insertions, 12 deletions
diff --git a/src/components/services/content/ServiceWebview.js b/src/components/services/content/ServiceWebview.js index 9919163b9..b1a2c0207 100644 --- a/src/components/services/content/ServiceWebview.js +++ b/src/components/services/content/ServiceWebview.js | |||
@@ -89,7 +89,7 @@ export default @observer class ServiceWebview extends Component { | |||
89 | 89 | ||
90 | return ( | 90 | return ( |
91 | <div className={webviewClasses}> | 91 | <div className={webviewClasses}> |
92 | {service.isActive && ( | 92 | {service.isActive && service.isEnabled && ( |
93 | <Fragment> | 93 | <Fragment> |
94 | {service.hasCrashed && ( | 94 | {service.hasCrashed && ( |
95 | <WebviewCrashHandler | 95 | <WebviewCrashHandler |
@@ -100,7 +100,7 @@ export default @observer class ServiceWebview extends Component { | |||
100 | )} | 100 | )} |
101 | {service.isEnabled && service.isLoading && service.isFirstLoad && ( | 101 | {service.isEnabled && service.isLoading && service.isFirstLoad && ( |
102 | <WebviewLoader | 102 | <WebviewLoader |
103 | loaded={!service.isLoading} | 103 | loaded={false} |
104 | name={service.name} | 104 | name={service.name} |
105 | /> | 105 | /> |
106 | )} | 106 | )} |
diff --git a/src/components/ui/WebviewLoader/index.js b/src/components/ui/WebviewLoader/index.js index 950312bbb..ab17199e5 100644 --- a/src/components/ui/WebviewLoader/index.js +++ b/src/components/ui/WebviewLoader/index.js | |||
@@ -1,16 +1,24 @@ | |||
1 | import React from 'react'; | 1 | import React, { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | 2 | import PropTypes from 'prop-types'; |
3 | import injectSheet from 'react-jss'; | ||
3 | 4 | ||
4 | import FullscreenLoader from '../FullscreenLoader'; | 5 | import FullscreenLoader from '../FullscreenLoader'; |
5 | 6 | ||
6 | const WebviewLoader = ({ name }) => ( | 7 | import styles from './styles'; |
7 | <FullscreenLoader | ||
8 | title={`Loading ${name}`} | ||
9 | /> | ||
10 | ); | ||
11 | 8 | ||
12 | WebviewLoader.propTypes = { | 9 | export default @injectSheet(styles) class WebviewLoader extends Component { |
13 | name: PropTypes.string.isRequired, | 10 | static propTypes = { |
14 | }; | 11 | name: PropTypes.string.isRequired, |
12 | classes: PropTypes.object.isRequired, | ||
13 | } | ||
15 | 14 | ||
16 | export default WebviewLoader; | 15 | render() { |
16 | const { classes, name } = this.props; | ||
17 | return ( | ||
18 | <FullscreenLoader | ||
19 | className={classes.component} | ||
20 | title={`Loading ${name}`} | ||
21 | /> | ||
22 | ); | ||
23 | } | ||
24 | } | ||
diff --git a/src/components/ui/WebviewLoader/styles.js b/src/components/ui/WebviewLoader/styles.js new file mode 100644 index 000000000..dbd75db8a --- /dev/null +++ b/src/components/ui/WebviewLoader/styles.js | |||
@@ -0,0 +1,9 @@ | |||
1 | export default theme => ({ | ||
2 | component: { | ||
3 | background: theme.colorWebviewLoaderBackground, | ||
4 | padding: 20, | ||
5 | width: 'auto', | ||
6 | margin: [0, 'auto'], | ||
7 | borderRadius: 6, | ||
8 | }, | ||
9 | }); | ||