Skip to content

Commit 2e09a37

Browse files
Copilotsanjay-kv
andauthored
fix: make discussion cards clickable to redirect to GitHub discussions
Agent-Logs-Url: https://github.com/recodehive/recode-website/sessions/2b0e0e44-7325-494a-adcf-d51ee605a1a0 Co-authored-by: sanjay-kv <30715153+sanjay-kv@users.noreply.github.com>
1 parent d7a4d49 commit 2e09a37

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/components/discussions/DiscussionCard.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ export default function DiscussionCard({
3737
discussion,
3838
index,
3939
}: DiscussionCardProps): JSX.Element {
40+
const handleCardClick = () => {
41+
window.open(discussion.html_url, "_blank", "noopener,noreferrer");
42+
};
4043
const formatDate = (dateString: string) => {
4144
const date = new Date(dateString);
4245
return date.toLocaleDateString("en-US", {
@@ -65,6 +68,13 @@ export default function DiscussionCard({
6568
animate={{ opacity: 1, y: 0 }}
6669
transition={{ duration: 0.5, delay: index * 0.1 }}
6770
whileHover={{ boxShadow: "0 4px 20px rgba(0,0,0,0.08)" }}
71+
onClick={handleCardClick}
72+
role="button"
73+
tabIndex={0}
74+
onKeyDown={(e) =>
75+
(e.key === "Enter" || e.key === " ") && handleCardClick()
76+
}
77+
aria-label={`Open discussion: ${discussion.title}`}
6878
>
6979
<div className="discussion-card-header">
7080
<div className="discussion-category-badge">
@@ -83,6 +93,7 @@ export default function DiscussionCard({
8393
href={discussion.html_url}
8494
target="_blank"
8595
rel="noopener noreferrer"
96+
onClick={(e) => e.stopPropagation()}
8697
>
8798
{discussion.title}
8899
</a>

0 commit comments

Comments
 (0)