mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-27 03:54:24 +00:00
Type action buttons
This commit is contained in:
parent
bd03a99137
commit
318a7731cf
1 changed files with 19 additions and 2 deletions
|
|
@ -1,8 +1,17 @@
|
|||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { previous, play, pause, stop, next } from "../../actionCreators";
|
||||
import { Dispatch } from "../../types";
|
||||
|
||||
const ActionButtons = props => (
|
||||
interface DispatchProps {
|
||||
previous(): void;
|
||||
play(): void;
|
||||
pause(): void;
|
||||
stop(): void;
|
||||
next(): void;
|
||||
}
|
||||
|
||||
const ActionButtons = (props: DispatchProps) => (
|
||||
<div className="actions">
|
||||
<div id="previous" onClick={props.previous} title="Previous Track" />
|
||||
<div id="play" onClick={props.play} title="Play" />
|
||||
|
|
@ -12,7 +21,15 @@ const ActionButtons = props => (
|
|||
</div>
|
||||
);
|
||||
|
||||
const mapDispatchToProps = { previous, play, pause, stop, next };
|
||||
const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => {
|
||||
return {
|
||||
previous: () => dispatch(previous()),
|
||||
play: () => dispatch(play()),
|
||||
pause: () => dispatch(pause()),
|
||||
stop: () => dispatch(stop()),
|
||||
next: () => dispatch(next())
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
null,
|
||||
Loading…
Add table
Add a link
Reference in a new issue