blob: 9ebe52dcfc0491d93196571ba54cc2b9d7694b05 [file] [log] [blame]
ilanap1965d162018-01-04 11:34:59 +02001/*
2 * Copyright © 2016-2017 European Support Limited
AviZi280f8012017-06-09 02:39:56 +03003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
ilanap1965d162018-01-04 11:34:59 +02008 * http://www.apache.org/licenses/LICENSE-2.0
AviZi280f8012017-06-09 02:39:56 +03009 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
ilanap1965d162018-01-04 11:34:59 +020012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
AviZi280f8012017-06-09 02:39:56 +030015 */
ilanap1965d162018-01-04 11:34:59 +020016
Michael Landoefa037d2017-02-19 12:57:33 +020017import React from 'react';
talig8e9c0652017-12-20 14:30:43 +020018import PropTypes from 'prop-types';
Michael Landoefa037d2017-02-19 12:57:33 +020019import {connect} from 'react-redux';
20
21const mapStateToProps = ({loader}) => {
22 return {
23 isLoading: loader.isLoading
24 };
25};
26
27class Loader extends React.Component {
28
29 static propTypes = {
talig8e9c0652017-12-20 14:30:43 +020030 isLoading: PropTypes.bool.isRequired
Michael Landoefa037d2017-02-19 12:57:33 +020031 };
32
33 static defaultProps = {
34 isLoading: false
35 };
36
ilanap1965d162018-01-04 11:34:59 +020037 shouldComponentUpdate(nextProps) {
38 return (nextProps.isLoading !== this.props.isLoading);
39 }
40
Michael Landoefa037d2017-02-19 12:57:33 +020041 render() {
42 let {isLoading} = this.props;
Michael Landoefa037d2017-02-19 12:57:33 +020043 return (
44 <div className='onboarding-loader'>
45 {
46 isLoading && <div className='onboarding-loader-backdrop'>
47 <div className='tlv-loader large'></div>
48 </div>
49 }
50 </div>
51 );
52 }
53}
54
55export default connect(mapStateToProps) (Loader);