Files
Iris/src/js/components/Fields/VolumeControl.js

39 lines
981 B
JavaScript
Raw Normal View History

2016-11-04 13:51:17 +13:00
import React from 'react';
import Icon from '../Icon';
import * as helpers from '../../helpers';
2016-11-04 13:51:17 +13:00
2018-03-23 16:54:56 +13:00
export default class VolumeControl extends React.Component{
2016-11-04 13:51:17 +13:00
2017-10-10 13:05:28 +13:00
constructor(props){
super(props);
this.handleChange = helpers.throttle(this.handleChange.bind(this), 100);
2016-11-04 13:51:17 +13:00
}
handleChange(value){
this.props.onVolumeChange(value, this.props.volume);
}
2016-11-04 13:51:17 +13:00
render(){
return (
<div className={"slider__wrapper "+(this.props.className ? this.props.className : "")}>
<div className={"slider slider--volume "+(this.props.mute ? "slider--muted" : "")}>
<input
className="slider__input"
type="range"
min="0"
max="25"
value={this.props.volume/4}
onChange={e => this.handleChange(parseInt(e.target.value)*4)}
/>
<div className="slider__track">
<div className="slider__track__progress" style={{ width: this.props.volume+'%' }}></div>
2016-11-04 13:51:17 +13:00
</div>
2017-06-22 08:59:40 +12:00
</div>
</div>
2016-11-04 13:51:17 +13:00
);
}
}