mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-24 02:36:00 +00:00
39 lines
883 B
JavaScript
39 lines
883 B
JavaScript
import React from "react";
|
|
import { connect } from "react-redux";
|
|
import classnames from "classnames";
|
|
import { toggleRepeat } from "../../actionCreators";
|
|
import ContextMenuWraper from "../ContextMenuWrapper";
|
|
import { Node } from "../ContextMenu";
|
|
|
|
const Repeat = ({ repeat, handleClick }) => (
|
|
<ContextMenuWraper
|
|
renderContents={() => (
|
|
<Node
|
|
checked={repeat}
|
|
label="Repeat"
|
|
onClick={handleClick}
|
|
hotkey="(R)"
|
|
/>
|
|
)}
|
|
>
|
|
<div
|
|
id="repeat"
|
|
className={classnames({ selected: repeat })}
|
|
onClick={handleClick}
|
|
title="Toggle Repeat"
|
|
/>
|
|
</ContextMenuWraper>
|
|
);
|
|
|
|
const mapStateToProps = state => ({
|
|
repeat: state.media.repeat
|
|
});
|
|
|
|
const mapDispatchToProps = dispatch => ({
|
|
handleClick: () => dispatch(toggleRepeat())
|
|
});
|
|
|
|
export default connect(
|
|
mapStateToProps,
|
|
mapDispatchToProps
|
|
)(Repeat);
|