22
33import { cn } from "@/lib/utils" ;
44import useSWR from "swr" ;
5- import { useState } from "react" ;
5+ import { RiExternalLinkLine } from "react-icons/ri" ;
6+ import { useState } from "react" ;
67
78type LinkCardProps = {
89 link : string ;
@@ -23,20 +24,23 @@ export default function LinkCard({ link }: LinkCardProps) {
2324 "md:w-7/12 h-full" ,
2425 "backdrop-blur-2xl overflow-hidden bg-slate-50/50 dark:bg-gray-800/70"
2526 ) } >
26- < div className = { "h-32 w-32 flex items-center" } >
27- < div className = { "rounded-xl h-full w-full bg-slate-300 dark:bg-slate-500" } > </ div >
28- </ div >
29- < div className = { "h-32 pl-4 flex-1 flex flex-col space-y-2" } >
27+ < div className = { "h-32 pr-4 flex-1 flex flex-col space-y-3" } >
3028 < div className = { "flex flex-col space-y-1" } >
3129 < div className = { "h-4 bg-slate-400 dark:bg-slate-500 rounded" } > </ div >
3230 < div className = { "h-4 bg-slate-400 dark:bg-slate-500 rounded" } > </ div >
3331 </ div >
3432 < div className = { "flex flex-col space-y-1" } >
3533 < div className = { "h-3 bg-slate-400 dark:bg-slate-500 rounded" } > </ div >
3634 < div className = { "h-3 bg-slate-400 dark:bg-slate-500 rounded" } > </ div >
37- < div className = { "h-3 bg-slate-400 dark:bg-slate-500 rounded" } > </ div >
35+ < div className = { "h-3 bg-slate-400 dark:bg-slate-500 rounded hidden md:block" } > </ div >
36+ </ div >
37+ < div className = { "flex flex-col space-y-1" } >
38+ < div className = { "h-2 bg-slate-400 dark:bg-slate-500 rounded" } > </ div >
3839 </ div >
3940 </ div >
41+ < div className = { "h-32 w-32 flex items-center" } >
42+ < div className = { "rounded-lg h-full w-full bg-slate-300 dark:bg-slate-500" } > </ div >
43+ </ div >
4044 </ div >
4145 </ div >
4246 )
@@ -46,14 +50,25 @@ export default function LinkCard({ link }: LinkCardProps) {
4650 if ( data ) return (
4751 < div onMouseEnter = { ( ) => setHover ( true ) }
4852 onMouseLeave = { ( ) => setHover ( false ) }
49- onClick = { ( ) => window . location . href = link }
53+ onClick = { ( ) => window . open ( link , '_blank' ) }
5054 style = { hover ? { cursor : 'pointer' } : { } }
5155 className = { cn (
5256 "flex p-2 mx-auto rounded-xl not-prose" ,
5357 "md:w-7/12 h-full duration-500" ,
5458 "backdrop-blur-2xl overflow-hidden bg-slate-50/50 dark:bg-gray-800/70" ,
5559 { "shadow-lg shadow-primary_color/50 dark:shadow-primary_color-dark/30" : hover }
5660 ) } >
61+ < div className = { "h-32 pr-4 flex-1 flex flex-col space-y-2" } >
62+ < div className = { "line-clamp-2 font-bold text-base" } >
63+ { data . ogTitle }
64+ </ div >
65+ < p className = { "line-clamp-2 md:line-clamp-3 font-light text-sm" } >
66+ { data . ogDescription }
67+ </ p >
68+ < p className = { "line-clamp-1 font-thin text-xs" } >
69+ { data . ogUrl }
70+ </ p >
71+ </ div >
5772 < div className = { "h-32 w-32 flex items-center" } >
5873 { data . ogImage && data . ogImage [ 0 ] ?. url ? (
5974 < img className = { "h-max w-max mx-auto rounded-lg" }
@@ -65,13 +80,11 @@ export default function LinkCard({ link }: LinkCardProps) {
6580 src = { "image-not-found.png" } />
6681 ) }
6782 </ div >
68- < div className = { "h-32 pl-4 flex-1 flex flex-col space-y-2" } >
69- < div className = { "line-clamp-2 font-bold text-base" } >
70- { data . ogTitle }
71- </ div >
72- < p className = { "line-clamp-3 font-light text-sm" } >
73- { data . ogDescription }
74- </ p >
83+ < div className = { "absolute top-2 right-2" } >
84+ < RiExternalLinkLine className = { cn (
85+ hover ? "text-primary_color dark:text-primary_color-dark" : "" ,
86+ "duration-500"
87+ ) } />
7588 </ div >
7689 </ div >
7790 )
0 commit comments