Skip to content

Commit

Permalink
feat: add testid to button (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
malinovic authored May 4, 2024
1 parent 1539257 commit 4c7d0b1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/like-button/like-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface LikeButtonProps {
plural: string;
};
onClick: () => void;
testid?: string;
}

const getLikesText = (
Expand All @@ -38,6 +39,7 @@ export const LikeButton: React.FC<LikeButtonProps> = ({
isDisabled = false,
labels,
onClick,
testid,
}) => {
const [isLiked, setIsLiked] = useState(isAlreadyLiked);
const [label, setLabel] = useState(getLikesText(count, labels));
Expand Down Expand Up @@ -90,6 +92,7 @@ export const LikeButton: React.FC<LikeButtonProps> = ({
icon={<HeartIcon size="s" color="base" />}
hoveredIcon={<HeartIcon size="s" color="secondary" />}
toggledIcon={<HeartIcon size="s" color="secondary" filled={true} />}
data-testid={testid}
/>
);
};

0 comments on commit 4c7d0b1

Please sign in to comment.