mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 01:29:22 +00:00
34 lines
862 B
TypeScript
34 lines
862 B
TypeScript
import React from "react";
|
|
import { connect } from "react-redux";
|
|
import classnames from "classnames";
|
|
|
|
import { SET_EQ_AUTO } from "../../actionTypes";
|
|
import { Dispatch, AppState } from "../../types";
|
|
|
|
interface StateProps {
|
|
auto: boolean;
|
|
}
|
|
|
|
interface DispatchProps {
|
|
toggleAuto(): void;
|
|
}
|
|
|
|
const EqAuto = (props: StateProps & DispatchProps) => {
|
|
const className = classnames({ selected: props.auto });
|
|
return <div id="auto" className={className} onClick={props.toggleAuto} />;
|
|
};
|
|
|
|
const mapStateToProps = (state: AppState): StateProps => {
|
|
return { auto: state.equalizer.auto };
|
|
};
|
|
const mapDispatchToProps = () => (dispatch: Dispatch): DispatchProps => {
|
|
// We don't support auto.
|
|
return {
|
|
toggleAuto: () => dispatch({ type: SET_EQ_AUTO, value: false }),
|
|
};
|
|
};
|
|
|
|
export default connect(
|
|
mapStateToProps,
|
|
mapDispatchToProps
|
|
)(EqAuto);
|