From 2869eaa09d69a3722443efd5274b15c523133147 Mon Sep 17 00:00:00 2001 From: Sam Glover Date: Mon, 9 Sep 2024 19:20:28 -0500 Subject: [PATCH] Change topic card links to interview landing page (#64) * Changes topic card links to landing page URLs Closes #51 * Uses HTML links instead of Javascript click handlers for interview liniks --- src/app/components/TopicCard.tsx | 98 +++++++++++++++----------------- 1 file changed, 47 insertions(+), 51 deletions(-) diff --git a/src/app/components/TopicCard.tsx b/src/app/components/TopicCard.tsx index c42a291..3ac1b1f 100644 --- a/src/app/components/TopicCard.tsx +++ b/src/app/components/TopicCard.tsx @@ -1,6 +1,7 @@ 'use client'; import Link from 'next/link'; import { useState } from 'react'; +import { toUrlFriendlyString } from '../utils/helpers'; interface TopicCardProps { topic: { @@ -52,65 +53,60 @@ const TopicCard = ({ setIsExpanded(!isExpanded); }; - const handleNavigation = (url) => { - window.location.href = url; - }; - return (
- -
-
-
- -
-
{topic.long_name}
+
+ +
+
-
-
- {displayInterviews.map((interview, index) => { - if (interview.metadata && interview.metadata.title) { - return ( - { - e.preventDefault(); - handleNavigation(interview.serverUrl + interview.link); - }} - > - {interview.metadata.title} - - ); - } - return null; - })} -
- {interviews.length > 3 && ( -
-
- {isExpanded ? 'Show Less' : 'Show More'} - -
-
- )} +
{topic.long_name}
+ +
+
+ {displayInterviews.map((interview, index) => { + if (interview.metadata && interview.metadata.title) { + return ( + + {interview.metadata.title} + + ); + } + return null; + })}
+ {interviews.length > 3 && ( +
+
+ {isExpanded ? 'Show Less' : 'Show More'} + +
+
+ )}
- +
); };