Skip to content

Commit

Permalink
update selectedInterests on click
Browse files Browse the repository at this point in the history
  • Loading branch information
zeucapua committed Sep 30, 2024
1 parent b845986 commit 1ceefca
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pages/explore/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,18 @@ function RecommendationSection({
<Text type="danger">Add some interests to get recommended repositories to contribute to!</Text>
<div className="flex flex-wrap gap-4">
{interestArray.map((topic, index) => (
<LanguageSwitch checked={selectedInterest.includes(topic)} onClick={() => {}} topic={topic} key={index} />
<LanguageSwitch
checked={selectedInterest.includes(topic)}
onClick={() => {
if (selectedInterest.length > 0 && selectedInterest.includes(topic)) {
setSelectedInterest((prev) => prev.filter((t) => topic !== t));
} else {
setSelectedInterest((prev) => [...prev, topic]);
}
}}
topic={topic}
key={index}
/>
))}
</div>
<Button
Expand Down

0 comments on commit 1ceefca

Please sign in to comment.