import React, { Component } from "react"; import PropTypes from "prop-types"; import { connect } from "react-redux"; import { changeVolume, changeVolumeMuted } from "actions/volume"; @connect(state => ({ volume: state.volume.get("volume"), muted: state.volume.get("muted"), })) export default class VolumeSlider extends Component { constructor(props) { super(props); } changeVolumeHandler = (volume) => { volume = volume / 100; localStorage.setItem("volume", volume); this.props.dispatch(changeVolume(volume)); }; muteVolume = () => { this.props.dispatch(changeVolumeMuted(true)); }; unmuteVolume = () => { this.props.dispatch(changeVolumeMuted(false)); }; render() { return (
{ (this.props.muted) ? ([ volume_off, , ]) : ([ volume_up, { this.changeVolumeHandler(e.target.value) } }/>, //Add default value ]) }
); } }