@@ -23,82 +23,102 @@ const TestimonialCard: React.FC<TestimonialCardProps> = ({
2323 const { colorMode } = useColorMode ( ) ;
2424 const isDark = colorMode === "dark" ;
2525
26- // Function to format the link display
2726 const formatLinkDisplay = ( url : string ) => {
2827 try {
2928 const urlObj = new URL ( url ) ;
30- return urlObj . hostname + urlObj . pathname ;
29+ return urlObj . hostname . replace ( "www." , "" ) ;
3130 } catch {
32- // If URL parsing fails, return the original link
3331 return url ;
3432 }
3533 } ;
3634
3735 return (
3836 < motion . div
39- initial = { { opacity : 0 } }
40- animate = { { opacity : 1 } }
41- exit = { { opacity : 0 } }
42- className = { `rounded-2xl p-6 shadow-lg hover:shadow-xl transition-shadow duration-300 h-[250px] flex flex-col justify-between ${
43- isDark ? "bg-[#1a1a1a] text-white" : "bg-white text-gray-900"
37+ initial = { { opacity : 0 , y : 12 } }
38+ animate = { { opacity : 1 , y : 0 } }
39+ exit = { { opacity : 0 , y : - 12 } }
40+ transition = { { duration : 0.3 } }
41+ className = { `rounded-2xl max-h-[400px] h-[350px] p-5 shadow-md hover:shadow-lg transition-all duration-300 flex flex-col justify-between ${
42+ isDark ? "bg-[#18181b] text-white" : "bg-white text-gray-900"
4443 } `}
4544 >
46- { /* Header with Avatar and Name */ }
45+ { /* Header */ }
4746 < div className = "flex items-center gap-4" >
48- < Avatar className = "w-24 h-24 rounded-full" >
49- < AvatarImage src = { avatar } className = "object-contain" />
50- < AvatarFallback > CN</ AvatarFallback >
47+ < Avatar className = "w-15 h-15 border border-gray-200 dark:border-gray-700" >
48+ < AvatarImage
49+ className = "w-15 h-15 object-cover "
50+ src = { avatar }
51+ alt = { name }
52+ />
53+ < AvatarFallback > { name ?. charAt ( 0 ) ?? "U" } </ AvatarFallback >
5154 </ Avatar >
5255 < div >
53- < h3 className = { `font-semibold text-lg ${ isDark ? "text-white" : "text-gray-900" } ` } >
54- { name }
55- </ h3 >
56- < p className = { `text-sm ${ isDark ? "text-gray-400" : "text-gray-500" } ` } >
56+ < h3 className = "font-semibold text-base" > { name } </ h3 >
57+ < p className = "text-sm text-gray-500 dark:text-gray-400" >
5758 @{ username }
5859 </ p >
5960 </ div >
6061 </ div >
6162
6263 { /* Content */ }
63- < p className = { `line-clamp-3 my-4 flex-grow ${ isDark ? "text-gray-300" : "text-gray-700" } ` } >
64- { content }
64+ < p
65+ className = { `mt-4 mb-3 text-sm leading-relaxed ${
66+ isDark ? "text-gray-300" : "text-gray-700"
67+ } `}
68+ >
69+ { content . length > 220 ? content . slice ( 0 , 220 ) + "..." : content }
6570 </ p >
6671
67- { /* Footer with Hashtags and Date */ }
72+ { /* Footer */ }
6873 < div
69- className = { `flex flex-col gap-2 text-sm pt-2 border-t ${
74+ className = { `pt-3 mt-auto border-t text-sm flex flex-col gap-2 ${
7075 isDark ? "border-gray-700" : "border-gray-100"
7176 } `}
7277 >
7378 { /* Hashtags */ }
74- < div className = "flex gap-2 flex-wrap" >
75- { content . match ( / # \w + / g) ?. map ( ( hashtag , index ) => (
76- < span
77- key = { index }
78- className = "text-blue-500 hover:text-blue-600 cursor-pointer"
79- >
80- { hashtag }
81- </ span >
82- ) ) }
83- </ div >
79+ { content . match ( / # \w + / g) && (
80+ < div className = "flex flex-wrap gap-2" >
81+ { content
82+ . match ( / # \w + / g)
83+ ?. slice ( 0 , 3 )
84+ . map ( ( tag , i ) => (
85+ < span
86+ key = { i }
87+ className = { `px-2 py-0.5 rounded-md text-xs font-medium ${
88+ isDark
89+ ? "bg-blue-900/40 text-blue-300"
90+ : "bg-blue-50 text-blue-700"
91+ } `}
92+ >
93+ { tag }
94+ </ span >
95+ ) ) }
96+ </ div >
97+ ) }
8498
85- { /* Link and Date Row */ }
99+ { /* Link and Date */ }
86100 < div className = "flex items-center justify-between" >
87- < a
88- href = { link }
89- target = "_blank"
101+ < a
102+ href = { link }
103+ target = "_blank"
90104 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"
105+ className = { `truncate max-w-[70%] text-sm font-medium hover:underline ${
106+ isDark
107+ ? "text-blue-400 hover:text-blue-300"
108+ : "text-blue-600 hover:text-blue-700"
93109 } `}
94110 >
95111 { formatLinkDisplay ( link ) }
96112 </ a >
97- < span className = { isDark ? "text-gray-500" : "text-gray-400" } > { date } </ span >
113+ < span
114+ className = { `text-xs ${ isDark ? "text-gray-500" : "text-gray-400" } ` }
115+ >
116+ { date }
117+ </ span >
98118 </ div >
99119 </ div >
100120 </ motion . div >
101121 ) ;
102122} ;
103123
104- export default TestimonialCard ;
124+ export default TestimonialCard ;
0 commit comments