Skip to content

Commit

Permalink
refactor: select contribution on whole card (#686)
Browse files Browse the repository at this point in the history
  • Loading branch information
haydencleary authored Nov 21, 2024
1 parent 3e12780 commit 01bf85b
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ export function UserContributions({ githubUserId, containerHeight = undefined }:
<div className={"grid gap-lg"}>
{otherWorks.map(contribution => {
const isSelected = !!selectedContributions.find(c => c.isEqualTo(contribution.toItemDto())) || false;

function selectContribution() {
handleSelect(contribution.toItemDto(), isSelected);
}

return (
<CardContributionKanban
key={contribution.id}
Expand All @@ -180,18 +185,22 @@ export function UserContributions({ githubUserId, containerHeight = undefined }:
actions={[
{
translate: { token: isSelected ? "common:unselect" : "common:select" },
onClick: () => {
handleSelect(contribution.toItemDto(), isSelected);
},
onClick: selectContribution,
},
]}
border={isSelected ? "brand-primary" : undefined}
githubHtmlUrl={contribution.htmlUrl}
onClick={selectContribution}
/>
);
})}
{mixedContributions.map(contribution => {
const isSelected = !!selectedContributions.find(c => c.isEqualTo(contribution.toItemDto())) || false;

function selectContribution() {
handleSelect(contribution.toItemDto(), isSelected);
}

return (
<CardContributionKanban
key={contribution.id}
Expand All @@ -207,13 +216,12 @@ export function UserContributions({ githubUserId, containerHeight = undefined }:
actions={[
{
translate: { token: isSelected ? "common:unselect" : "common:select" },
onClick: () => {
handleSelect(contribution.toItemDto(), isSelected);
},
onClick: selectContribution,
},
]}
border={isSelected ? "brand-primary" : undefined}
githubHtmlUrl={contribution.githubHtmlUrl}
onClick={selectContribution}
/>
);
})}
Expand Down

0 comments on commit 01bf85b

Please sign in to comment.