import React from 'react'; import Icon from '../Icon'; import * as helpers from '../../helpers'; export default class VolumeControl extends React.Component{ constructor(props){ super(props); this.handleChange = helpers.throttle(this.handleChange.bind(this), 100); } handleChange(value){ this.props.onVolumeChange(value, this.props.volume); } renderMuteButton(){ if (this.props.mute){ return ( this.props.onMuteChange(false)}> Unmute ) } else { return ( this.props.onMuteChange(true)}> Mute ) } } render(){ var className = "volume-control"; if (this.props.mute){ className += " muted"; } if (this.props.className){ className += " "+this.props.className; } return ( {this.props.NoMuteButton ? null : this.renderMuteButton()}
this.handleChange(parseInt(e.target.value)*4)} />
); } }