Add setting to manage visibility of vote count, vote button and decide root page (#197)

This commit is contained in:
Riccardo Graziosi
2023-02-05 11:55:38 +01:00
committed by GitHub
parent d4242dd78e
commit e7335f5622
35 changed files with 246 additions and 48 deletions

View File

@@ -2,7 +2,9 @@ import * as React from 'react';
interface Props {
postId: number;
likesCount: number;
likeCount: number;
showLikeCount?: boolean;
showLikeButton?: boolean;
liked: number;
handleLikeSubmit(
postId: number,
@@ -15,7 +17,9 @@ interface Props {
const LikeButtonP = ({
postId,
likesCount,
likeCount,
showLikeCount = true,
showLikeButton = true,
liked,
handleLikeSubmit,
authenticityToken,
@@ -29,9 +33,10 @@ const LikeButtonP = ({
else window.location.href = `/users/sign_in`;
}}
className={`likeButton${liked ? ' liked' : ''}`}
hidden={!showLikeButton}
>
</div>
<span className="likesCountLabel">{likesCount}</span>
{ showLikeCount && <span className="likeCountLabel">{likeCount}</span> }
</div>
);