mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-24 02:36:00 +00:00
33 lines
894 B
TypeScript
33 lines
894 B
TypeScript
import React from "react";
|
|
import classnames from "classnames";
|
|
import * as Actions from "../../actionCreators";
|
|
import * as Selectors from "../../selectors";
|
|
import ContextMenuWraper from "../ContextMenuWrapper";
|
|
import { Node } from "../ContextMenu";
|
|
import { useTypedSelector, useActionCreator } from "../../hooks";
|
|
|
|
const Repeat = React.memo(() => {
|
|
const repeat = useTypedSelector(Selectors.getRepeat);
|
|
const handleClick = useActionCreator(Actions.toggleRepeat);
|
|
return (
|
|
<ContextMenuWraper
|
|
renderContents={() => (
|
|
<Node
|
|
checked={repeat}
|
|
label="Repeat"
|
|
onClick={handleClick}
|
|
hotkey="(R)"
|
|
/>
|
|
)}
|
|
>
|
|
<div
|
|
id="repeat"
|
|
className={classnames({ selected: repeat })}
|
|
onClick={handleClick}
|
|
title="Toggle Repeat"
|
|
/>
|
|
</ContextMenuWraper>
|
|
);
|
|
});
|
|
|
|
export default Repeat;
|