Refactor FollowButton to use named function export

This commit is contained in:
srgooglo 2025-07-04 14:09:41 +02:00
parent 7206f00c00
commit 678c0c1a4c

View File

@ -1,26 +1,28 @@
import React from "react"
import { Button } from "antd" import { Button } from "antd"
import classnames from "classnames" import classnames from "classnames"
import "./index.less" import "./index.less"
export default (props) => { const FollowButton = (props) => {
return <div className="followButton"> return (
<div className="counter"> <div className="followButton">
{props.count} <div className="counter">
{props.self && " Followers"} {props.count}
</div> {props.self && " Followers"}
{ </div>
!props.self && <Button {!props.self && (
type="ghost" <Button
onClick={props.onClick} type="ghost"
className={classnames( onClick={props.onClick}
"btn", className={classnames("btn", {
{ ["followed"]: props.followed } ["followed"]: props.followed,
)} })}
> >
<span>{props.followed ? "Following" : "Follow"}</span> <span>{props.followed ? "Following" : "Follow"}</span>
</Button> </Button>
} )}
</div> </div>
)
} }
export default FollowButton