mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-24 02:36:00 +00:00
31 lines
985 B
TypeScript
31 lines
985 B
TypeScript
import React from "react";
|
|
import { connect } from "react-redux";
|
|
import { SELECT_ALL, SELECT_ZERO, INVERT_SELECTION } from "../../actionTypes";
|
|
import PlaylistMenu from "./PlaylistMenu";
|
|
import { Dispatch } from "../../types";
|
|
|
|
interface DispatchProps {
|
|
invertSelection: () => void;
|
|
selectZero: () => void;
|
|
selectAll: () => void;
|
|
}
|
|
|
|
const SelectionMenu = (props: DispatchProps) => (
|
|
<PlaylistMenu id="playlist-selection-menu">
|
|
<div className="invert-selection" onClick={props.invertSelection} />
|
|
<div className="select-zero" onClick={props.selectZero} />
|
|
<div className="select-all" onClick={props.selectAll} />
|
|
</PlaylistMenu>
|
|
);
|
|
|
|
const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => {
|
|
return {
|
|
invertSelection: () => dispatch({ type: INVERT_SELECTION }),
|
|
selectAll: () => dispatch({ type: SELECT_ALL }),
|
|
selectZero: () => dispatch({ type: SELECT_ZERO })
|
|
};
|
|
};
|
|
export default connect(
|
|
null,
|
|
mapDispatchToProps
|
|
)(SelectionMenu);
|