Skip to content

Commit

Permalink
Merge pull request #8 from saracrz/feature/add-clicking-on-card.title
Browse files Browse the repository at this point in the history
Add event propagation to avoid clicking on favorite
  • Loading branch information
saracrz authored Nov 13, 2023
2 parents 9d9dd62 + eaecc6e commit 66aaf8e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/containers/CollapsibleCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ export const CollapsibleCard: FC<ICollapsibleCard> = ({
setOpenCardId(isCollapsed ? id : null);
};

const toggleFavorite = () => {
const toggleFavorite = (event: React.MouseEvent) => {
event.stopPropagation();
setFavorite(!isFavorite);
localStorage.setItem(dashboardTitle, !isFavorite ? "favorite" : "");
};

return (
<CollapsibleCardWrapper>
<CollapsibleCardWrapper onClick={toggleCollapse}>
<Card>
<CollapsibleTitleWrapper>
<h6>{dashboardTitle}</h6>
Expand Down

0 comments on commit 66aaf8e

Please sign in to comment.