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