mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 18:25:30 +00:00
22 lines
508 B
JavaScript
22 lines
508 B
JavaScript
import React from "react";
|
|
import { connect } from "react-redux";
|
|
|
|
import Volume from "../Volume";
|
|
|
|
const MainVolume = props => {
|
|
const { volume } = props;
|
|
const percent = volume / 100;
|
|
const sprite = Math.round(percent * 28);
|
|
const offset = (sprite - 1) * 15;
|
|
|
|
const style = {
|
|
backgroundPosition: `0 -${offset}px`
|
|
};
|
|
return <Volume style={style} id="volume" />;
|
|
};
|
|
|
|
const mapStateToProps = state => ({
|
|
volume: state.media.volume
|
|
});
|
|
|
|
export default connect(mapStateToProps)(MainVolume);
|