File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -72,13 +72,16 @@ const Card = ({
72
72
key = { paper . _id }
73
73
className = { `w-56 space-y-1 rounded-xl border border-black dark:border-[#7480FF]/25 ${ checked ? "bg-[#EEF2FF] dark:bg-[#050b1f]" : "" } p-4 ` }
74
74
>
75
- < Link href = { paper . finalUrl } >
75
+ < Link
76
+ href = { paper . finalUrl }
77
+ target = "_blank"
78
+ rel = "noopener noreferrer"
79
+ >
76
80
< Image
77
81
src = { paper . thumbnailUrl }
78
82
alt = { paper . subject }
79
83
width = { 320 }
80
84
height = { 180 }
81
- onClick = { handleOpen }
82
85
className = "mb-2 h-[180px] w-full cursor-pointer object-cover"
83
86
/>
84
87
</ Link >
@@ -94,7 +97,7 @@ const Card = ({
94
97
{ capsule ( paper . slot ) }
95
98
{ capsule ( paper . year ) }
96
99
</ div >
97
- < div className = "hidden md:flex items-center justify-between gap-2" >
100
+ < div className = "hidden items-center justify-between gap-2 md:flex " >
98
101
< div className = "flex items-center gap-1" >
99
102
< input
100
103
checked = { checked }
Original file line number Diff line number Diff line change @@ -8,20 +8,31 @@ import { capsule } from "@/util/utils";
8
8
import Link from "next/link" ;
9
9
10
10
const PreviewCard = ( { paper } : { paper : Paper } ) => {
11
+
12
+ function handleOpen ( event : React . MouseEvent ) {
13
+ event . stopPropagation ( ) ;
14
+ const link = document . createElement ( "a" ) ;
15
+ link . href = paper . finalUrl ;
16
+ link . target = "_blank" ;
17
+ link . rel = "noopener noreferrer" ;
18
+ document . body . appendChild ( link ) ;
19
+ link . click ( ) ;
20
+ document . body . removeChild ( link ) ;
21
+ }
11
22
return (
12
23
< div
13
24
key = { paper . _id }
14
25
className = "w-56 space-y-1 rounded-xl border border-black border-opacity-50 p-4 dark:border-[#7480FF]/25"
15
26
>
16
- < Link href = { paper . finalUrl } target = "_blank" rel = "noopener noreferrer ">
27
+ < button onClick = { handleOpen } className = "w-full ">
17
28
< Image
18
29
src = { paper . thumbnailUrl }
19
30
alt = { paper . subject }
20
31
width = { 180 }
21
32
height = { 180 }
22
33
className = "mb-2 h-[150px] w-full object-cover"
23
34
/>
24
- </ Link >
35
+ </ button >
25
36
< div className = "text-sm font-medium" >
26
37
{ extractBracketContent ( paper . subject ) }
27
38
</ div >
You can’t perform that action at this time.
0 commit comments