Factor out generic loading screen component from SplashScreen

This commit is contained in:
Alex Liebowitz 2016-09-21 01:19:23 -04:00
parent 4d34bb1599
commit 19d12955a5
3 changed files with 51 additions and 28 deletions

1
dist/index.html vendored
View file

@ -34,6 +34,7 @@
<script src="./js/component/header.js"></script>
<script src="./js/component/drawer.js"></script>
<script src="./js/component/splash.js"></script>
<script src="./js/component/load_screen.js"></script>
<script src="./js/page/discover.js"></script>
<script src="./js/page/settings.js"></script>
<script src="./js/page/help.js"></script>

View file

@ -0,0 +1,49 @@
var loadScreenStyle = {
color: 'white',
backgroundImage: 'url(' + lbry.imagePath('lbry-bg.png') + ')',
backgroundSize: 'cover',
minHeight: '100vh',
minWidth: '100vw',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center'
}, loadScreenMessageStyle = {
marginTop: '24px',
width: '325px',
textAlign: 'center',
};
var LoadScreen = React.createClass({
propTypes: {
message: React.PropTypes.string.isRequired,
details: React.PropTypes.string,
isWarning: React.PropTypes.bool,
},
getDefaultProps: function() {
return {
isWarning: false,
}
},
getInitialState: function() {
return {
message: null,
details: null,
isLagging: false,
}
},
render: function() {
var imgSrc = lbry.imagePath('lbry-white-485x160.png');
return (
<div className="load-screen" style={loadScreenStyle}>
<img src={imgSrc} alt="LBRY"/>
<div style={loadScreenMessageStyle}>
<h3>
<BusyMessage message={this.props.message} />
</h3>
<Icon icon='icon-warning' style={this.props.isWarning ? {} : { display: 'none' }}/> <span style={ this.state.isWarning ? {} : {'color': '#c3c3c3'} }>{this.props.details}</span>
</div>
</div>
);
}
});

View file

@ -1,19 +1,3 @@
var splashStyle = {
color: 'white',
backgroundImage: 'url(' + lbry.imagePath('lbry-bg.png') + ')',
backgroundSize: 'cover',
minHeight: '100vh',
minWidth: '100vw',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center'
}, splashMessageStyle = {
marginTop: '24px',
width: '325px',
textAlign: 'center',
};
var SplashScreen = React.createClass({
propTypes: {
message: React.PropTypes.string,
@ -46,17 +30,6 @@ var SplashScreen = React.createClass({
this.updateStatus();
},
render: function() {
var imgSrc = lbry.imagePath('lbry-white-485x160.png');
return (
<div className="splash-screen" style={splashStyle}>
<img src={imgSrc} alt="LBRY"/>
<div style={splashMessageStyle}>
<h3>
<BusyMessage message={this.props.message} />
</h3>
<Icon icon='icon-warning' style={this.state.isLagging ? {} : { display: 'none' }}/> <span style={ this.state.isLagging ? {} : {'color': '#c3c3c3'} }>{this.state.details}</span>
</div>
</div>
);
return <LoadScreen message={this.props.message} details={this.state.details} isWarning={this.state.isLagging} />;
}
});