Type Minimize

This commit is contained in:
Jordan Eldredge 2018-09-28 07:03:45 -07:00
parent 839444fe86
commit 5d6b2d40dc
4 changed files with 34 additions and 19 deletions

View file

@ -2,7 +2,8 @@ import {
CLOSE_WINAMP,
STOP,
TOGGLE_VISUALIZER_STYLE,
CLOSE_REQUESTED
CLOSE_REQUESTED,
MINIMIZE_WINAMP
} from "../actionTypes";
import { Dispatchable } from "../types";
@ -93,3 +94,7 @@ export function close(): Dispatchable {
export function toggleVisualizerStyle(): Dispatchable {
return { type: TOGGLE_VISUALIZER_STYLE };
}
export function minimize(): Dispatchable {
return { type: MINIMIZE_WINAMP };
}

View file

@ -1,7 +1,12 @@
import React from "react";
import classnames from "classnames";
interface Props {
type DivProps = React.DetailedHTMLProps<
React.HTMLAttributes<HTMLDivElement>,
HTMLDivElement
>;
interface Props extends DivProps {
className?: string;
onMouseDown?: (e: React.MouseEvent<HTMLDivElement>) => void;
}

View file

@ -1,17 +0,0 @@
import React from "react";
import { connect } from "react-redux";
import ClickedDiv from "../ClickedDiv";
import { MINIMIZE_WINAMP } from "../../actionTypes";
const Minimize = ({ minimize }) => (
<ClickedDiv id="minimize" title="Minimize" onClick={minimize} />
);
const mapDispatchToProps = {
minimize: () => ({ type: MINIMIZE_WINAMP })
};
export default connect(
null,
mapDispatchToProps
)(Minimize);

View file

@ -0,0 +1,22 @@
import React from "react";
import { connect } from "react-redux";
import ClickedDiv from "../ClickedDiv";
import * as Actions from "../../actionCreators";
import { Dispatch } from "../../types";
interface Props {
minimize(): void;
}
const Minimize = ({ minimize }: Props) => (
<ClickedDiv id="minimize" title="Minimize" onClick={minimize} />
);
const mapDispatchToProps = (dispatch: Dispatch) => ({
minimize: () => dispatch(Actions.minimize())
});
export default connect(
null,
mapDispatchToProps
)(Minimize);