Sha256: 6b04c11f1d54ea574a80e58ae53242c906e046f3b6fa773aa30b01fd3eb57cb4

Contents?: true

Size: 1023 Bytes

Versions: 27

Compression:

Stored size: 1023 Bytes

Contents

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Spinner } from 'patternfly-react';
import './LoadingState.scss';

class LoadingState extends Component {
  constructor(props) {
    super(props);
    this.state = {
      render: false,
    };
  }

  componentDidMount() {
    setTimeout(() => {
      this.setState({ render: true });
    }, this.props.timeout);
  }

  render() {
    const { loading, loadingText, children } = this.props;
    const spinner = (
      <div className="loading-state">
        <Spinner loading={loading} size="lg" />
        <p>{loadingText}</p>
      </div>);

    if (loading) {
      return this.state.render ? spinner : null;
    }
    return children;
  }
}
LoadingState.propTypes = {
  loading: PropTypes.bool,
  loadingText: PropTypes.string,
  children: PropTypes.node,
  timeout: PropTypes.number,
};

LoadingState.defaultProps = {
  loading: false,
  loadingText: __('Loading'),
  children: null,
  timeout: 300,
};

export default LoadingState;

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
katello-3.12.3 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.12.2 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.12.1 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.11.2 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.10.2 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.12.0 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.12.0.rc2 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.10.1.1 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.12.0.rc1 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.10.1 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.11.1 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.11.0 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.11.0.rc2 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.11.0.rc1 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.10.0 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.10.0.rc1.1 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.9.1 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.10.0.rc1 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.9.0 webpack/move_to_pf/LoadingState/LoadingState.js
katello-3.8.1 webpack/move_to_pf/LoadingState/LoadingState.js