mirror of
https://github.com/wassname/talk.git
synced 2026-07-26 13:37:38 +08:00
fix: correct typings
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user