2017-05-23 08:50:53 +12:00
|
|
|
|
|
|
|
|
import React, { PropTypes } from 'react'
|
|
|
|
|
import FontAwesome from 'react-fontawesome'
|
|
|
|
|
|
|
|
|
|
import Icon from '../Icon'
|
|
|
|
|
import * as helpers from '../../helpers'
|
|
|
|
|
|
|
|
|
|
export default class VolumeModal extends React.Component{
|
|
|
|
|
constructor(props){
|
|
|
|
|
super(props)
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-24 08:41:41 +12:00
|
|
|
changeVolume(e){
|
2017-05-23 08:50:53 +12:00
|
|
|
var slider = e.target;
|
|
|
|
|
|
|
|
|
|
var sliderY = e.clientY - slider.getBoundingClientRect().top;
|
|
|
|
|
var sliderHeight = slider.getBoundingClientRect().height;
|
|
|
|
|
var percent = 100 - parseInt( sliderY / sliderHeight * 100 );
|
|
|
|
|
|
|
|
|
|
this.props.mopidyActions.setVolume( percent )
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-24 08:41:41 +12:00
|
|
|
toggleMute(e){
|
|
|
|
|
this.props.mopidyActions.setMute(!this.props.mute)
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-23 08:50:53 +12:00
|
|
|
render(){
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
2017-05-24 08:41:41 +12:00
|
|
|
<a className="toggle-mute" onClick={e => this.toggleMute(e)}>
|
|
|
|
|
{this.props.mute ? <FontAwesome className="muted" name="volume-off" /> : <FontAwesome name="volume-down" />}
|
|
|
|
|
</a>
|
|
|
|
|
<div className={this.props.mute ? "slider vertical disabled" : "slider vertical"} onClick={e => this.changeVolume(e)}>
|
2017-05-23 18:12:06 +12:00
|
|
|
<div className="track">
|
|
|
|
|
<div className="progress" style={{ height: this.props.volume+'%' }}></div>
|
2017-05-23 08:50:53 +12:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|