fix: correct typings

This commit is contained in:
Chi Vinh Le
2018-10-04 19:48:56 +02:00
parent 2a4dfdd3de
commit 5bf4c66b40
2 changed files with 5 additions and 7 deletions
@@ -3,7 +3,7 @@ import React from "react";
import { Button, ButtonIcon, MatchMedia } from "talk-ui/components";
interface ReactionButtonProps {
onButtonClick: () => {};
onClick: () => void;
totalReactions: number;
reacted: boolean | null;
label: string;
@@ -17,7 +17,7 @@ class ReactionButton extends React.Component<ReactionButtonProps> {
public render() {
const { totalReactions, reacted } = this.props;
return (
<Button variant="ghost" size="small" onClick={this.props.onButtonClick}>
<Button variant="ghost" size="small" onClick={this.props.onClick}>
{!!totalReactions && <span>{totalReactions}</span>}
<MatchMedia gtWidth="xs">
<ButtonIcon>
@@ -22,7 +22,7 @@ interface ReactionButtonContainerProps {
class ReactionButtonContainer extends React.Component<
ReactionButtonContainerProps
> {
private onButtonClick = () => {
private handleClick = () => {
const input = {
commentID: this.props.comment.id,
};
@@ -32,9 +32,7 @@ class ReactionButtonContainer extends React.Component<
this.props.comment.myActionPresence &&
this.props.comment.myActionPresence.reaction;
return reacted
? deleteCommentReaction(input)
: createCommentReaction(input);
reacted ? deleteCommentReaction(input) : createCommentReaction(input);
};
public render() {
const {
@@ -52,7 +50,7 @@ class ReactionButtonContainer extends React.Component<
return (
<ReactionButton
onButtonClick={this.onButtonClick}
onClick={this.handleClick}
totalReactions={totalReactions}
reacted={reacted}
label={label}