Skip to content

Commit 4ccacd9

Browse files
authored
Merge pull request #553 from Adez017/blogs
Added link to the testimonies card
2 parents 61c3753 + daae425 commit 4ccacd9

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

src/components/testimonials/TestimonialCard.tsx

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ interface TestimonialCardProps {
99
content: string;
1010
date: string;
1111
avatar: string;
12+
link: string;
1213
}
1314

1415
const TestimonialCard: React.FC<TestimonialCardProps> = ({
@@ -17,10 +18,22 @@ const TestimonialCard: React.FC<TestimonialCardProps> = ({
1718
content,
1819
date,
1920
avatar,
21+
link,
2022
}) => {
2123
const { colorMode } = useColorMode();
2224
const isDark = colorMode === "dark";
2325

26+
// Function to format the link display
27+
const formatLinkDisplay = (url: string) => {
28+
try {
29+
const urlObj = new URL(url);
30+
return urlObj.hostname + urlObj.pathname;
31+
} catch {
32+
// If URL parsing fails, return the original link
33+
return url;
34+
}
35+
};
36+
2437
return (
2538
<motion.div
2639
initial={{ opacity: 0 }}
@@ -53,10 +66,11 @@ const TestimonialCard: React.FC<TestimonialCardProps> = ({
5366

5467
{/* Footer with Hashtags and Date */}
5568
<div
56-
className={`flex items-center justify-between text-sm pt-2 border-t ${
69+
className={`flex flex-col gap-2 text-sm pt-2 border-t ${
5770
isDark ? "border-gray-700" : "border-gray-100"
5871
}`}
5972
>
73+
{/* Hashtags */}
6074
<div className="flex gap-2 flex-wrap">
6175
{content.match(/#\w+/g)?.map((hashtag, index) => (
6276
<span
@@ -67,10 +81,24 @@ const TestimonialCard: React.FC<TestimonialCardProps> = ({
6781
</span>
6882
))}
6983
</div>
70-
<span className={isDark ? "text-gray-500" : "text-gray-400"}>{date}</span>
84+
85+
{/* Link and Date Row */}
86+
<div className="flex items-center justify-between">
87+
<a
88+
href={link}
89+
target="_blank"
90+
rel="noopener noreferrer"
91+
className={`hover:underline cursor-pointer ${
92+
isDark ? "text-blue-400 hover:text-blue-300" : "text-blue-600 hover:text-blue-700"
93+
}`}
94+
>
95+
{formatLinkDisplay(link)}
96+
</a>
97+
<span className={isDark ? "text-gray-500" : "text-gray-400"}>{date}</span>
98+
</div>
7199
</div>
72100
</motion.div>
73101
);
74102
};
75103

76-
export default TestimonialCard;
104+
export default TestimonialCard;

src/components/testimonials/TestimonialCarousel.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,24 @@ const testimonials = [
1818
username: "RashiChouhan",
1919
content: "Valuable insights shared, productive discussions, and actionable outcomes. Looking forward to implementing the strategies discussed.! #TechCommunity #WomenInTech",
2020
date: "May 18, 2024",
21-
avatar: "/icons/adobe.png"
21+
avatar: "/icons/adobe.png",
22+
link: "https://topmate.io/sanjaykv"
2223
},
2324
{
2425
name: "Namith",
2526
username: "namith",
2627
content: "Gave remarkable insights on parts i have to improve and gave me new opportunities . cheers~! #TechCommunity #Grateful",
2728
date: "April 21, 2023",
28-
avatar: "/icons/google.png"
29+
avatar: "/icons/google.png",
30+
link: "https://topmate.io/sanjaykv"
2931
},
3032
{
3133
name: "Rajdeep Chakraborty",
3234
username: "RajdeepChakraborty",
3335
content: "I appreciate Sanjay sir's insights on open source and his suggestions for improving my GitHub profile. I'm excited to hear more and discuss open source further.! #OpenSource #TechCommunity",
3436
date: "Oct 18, 2024",
35-
avatar: "/icons/amazon.png"
37+
avatar: "/icons/amazon.png",
38+
link: "https://topmate.io/sanjaykv"
3639
}
3740
];
3841

0 commit comments

Comments
 (0)