Sha256: 1b43d2fe6acfdbe3d7a66d0b70f9c861e6a552cbd9a8e27b865a4cb358ce6466

Contents?: true

Size: 1.22 KB

Versions: 12

Compression:

Stored size: 1.22 KB

Contents

Rev.registerComponent('ProgressBar', class ProgressBar extends React.Component {

  static get propTypes() {
    return {
      value: React.PropTypes.number,
      minValue: React.PropTypes.number,
      maxValue: React.PropTypes.number,
      success: React.PropTypes.bool,
      secondary: React.PropTypes.bool,
      alert: React.PropTypes.bool,
    }
  }

  static get defaultProps() {
    return {
      value: 0,
      minValue: 0,
      maxValue: 1,
      success: false,
      secondary: false,
      alert: false,
    }
  }

  get className() {
    return this.classAdd({
      'RevProgressBar': true,
      'progress': true,
      'success': this.props.success,
      'secondary': this.props.secondary,
      'alert': this.props.alert,
    })
  }

  get fillClassName() {
    return this.classSet({
      'RevProgressBar-fill': true,
      'meter': true,
    })
  }

  get fillRatio() {
    let {value, minValue, maxValue} = this.props
    return Math.min(1, (value - minValue) / (maxValue - minValue))
  }

  get fillStyle() {
    return {width: `${this.fillRatio*100}%`}
  }

  render() {
    return <div {...this.props} className={this.className}>
      <span className={this.fillClassName} style={this.fillStyle} />
    </div>
  }

})

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
revelry_core-0.1.24.0 app/assets/javascripts/revelry/ui/visuals/ProgressBar.es6
revelry_core-0.1.23.0 app/assets/javascripts/revelry/ui/visuals/ProgressBar.es6
revelry_core-0.1.22.0 app/assets/javascripts/revelry/ui/visuals/ProgressBar.es6
revelry_core-0.1.21.0 app/assets/javascripts/revelry/ui/visuals/ProgressBar.es6
revelry_core-0.1.20.0 app/assets/javascripts/revelry/ui/visuals/ProgressBar.es6
revelry_core-0.1.19.0 app/assets/javascripts/revelry/ui/visuals/ProgressBar.es6
revelry_core-0.1.18.0 app/assets/javascripts/revelry/ui/visuals/ProgressBar.es6
revelry_core-0.1.17.0 app/assets/javascripts/revelry/ui/visuals/ProgressBar.es6
revelry_core-0.1.16.0 app/assets/javascripts/revelry/ui/visuals/ProgressBar.es6
revelry_core-0.1.15.0 app/assets/javascripts/revelry/ui/visuals/ProgressBar.es6
revelry_core-0.1.14.0 app/assets/javascripts/revelry/ui/visuals/ProgressBar.es6
revelry_core-0.1.13.0 app/assets/javascripts/revelry/ui/visuals/ProgressBar.es6