diff --git a/packages/app/src/components/PostCard/index.jsx b/packages/app/src/components/PostCard/index.jsx index df77ec97..2ad8d00b 100644 --- a/packages/app/src/components/PostCard/index.jsx +++ b/packages/app/src/components/PostCard/index.jsx @@ -1,10 +1,54 @@ import React from "react" import * as antd from "antd" import { Icons } from "components/Icons" +import classnames from "classnames" import moment from "moment" +import { User } from "models" + import "./index.less" +function LikeButton(props) { + const [liked, setLiked] = React.useState(props.defaultLiked ?? false) + + const handleClick = async () => { + let to = !liked + + if (typeof props.onClick === "function") { + const result = await props.onClick(to) + if (typeof result === "boolean") { + to = result + } + } + + setLiked(to) + } + + return +} + function PostHeader({ postData }) { const [timeAgo, setTimeAgo] = React.useState(0) @@ -50,9 +94,9 @@ function PostContent({ message }) { function PostActions(props) { return