Add style to like button

This commit is contained in:
riggraz
2019-09-27 18:19:13 +02:00
parent 80164178c2
commit ce234f8818
6 changed files with 69 additions and 35 deletions

View File

@@ -22,14 +22,15 @@ const LikeButtonP = ({
isLoggedIn,
}: Props) => (
<div className="likeButtonContainer">
<button onClick={() =>
isLoggedIn ?
handleLikeSubmit(postId, !liked, authenticityToken)
:
window.location.href = `/users/sign_in`
}>
{ liked ? 'down' : 'up' }
</button>
<div onClick={(e) => {
e.stopPropagation();
if (isLoggedIn) handleLikeSubmit(postId, !liked, authenticityToken);
else window.location.href = `/users/sign_in`;
}}
className={`likeButton${liked ? ' liked' : ''}`}
>
</div>
<span className="likesCountLabel">{likesCount}</span>
</div>
);