mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
Continue work on brewery page, implement like system
This commit is contained in:
37
src/components/ui/LikeButton.tsx
Normal file
37
src/components/ui/LikeButton.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import { FC } from 'react';
|
||||
import { FaThumbsUp, FaRegThumbsUp } from 'react-icons/fa';
|
||||
|
||||
interface LikeButtonProps {
|
||||
isLiked: boolean;
|
||||
handleLike: () => Promise<void>;
|
||||
loading: boolean;
|
||||
}
|
||||
|
||||
const LikeButton: FC<LikeButtonProps> = ({ isLiked, handleLike, loading }) => {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className={`btn-sm btn gap-2 rounded-2xl lg:btn-md ${
|
||||
!isLiked ? 'btn-ghost outline' : 'btn-primary'
|
||||
}`}
|
||||
onClick={() => {
|
||||
handleLike();
|
||||
}}
|
||||
disabled={loading}
|
||||
>
|
||||
{isLiked ? (
|
||||
<>
|
||||
<FaThumbsUp className="lg:text-2xl" />
|
||||
Liked
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<FaRegThumbsUp className="lg:text-2xl" />
|
||||
Like
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
||||
export default LikeButton;
|
||||
Reference in New Issue
Block a user