@@ -43,14 +43,27 @@ function TagChip({ tag, isSelected, setSelectedTag }) {
43
43
) ;
44
44
}
45
45
46
+ const handleContainerClick = ( event , tutorial , history ) => {
47
+ if ( event . target . closest ( 'a' ) ) return ;
48
+ history . push ( `/tutorials${ tutorial . slug } ` )
49
+ }
50
+
46
51
const handleClick = ( event ) => {
47
52
event . stopPropagation ( ) ;
48
53
} ;
49
54
50
55
function TutorialListCell ( { tutorial } ) {
56
+ const history = useHistory ( )
51
57
const authorData = authors [ tutorial . author ] ;
52
58
return (
53
- < Link to = { `/tutorials${ tutorial . slug } ` } >
59
+ // <Link to={`/tutorials${tutorial.slug}`}>
60
+ < div
61
+ onClick = { ( event ) => {
62
+ handleContainerClick ( event , tutorial , history )
63
+ } }
64
+ role = "button"
65
+ tabIndex = { 0 }
66
+ >
54
67
< div className = { clsx ( styles . tutorialListCell , 'container' ) } >
55
68
< header >
56
69
< h2 className = { clsx ( styles . tutorialListTitle ) } > { tutorial . title } </ h2 >
@@ -73,10 +86,11 @@ function TutorialListCell({ tutorial }) {
73
86
) }
74
87
< div className = { clsx ( styles . tutorialListCellInfo ) } >
75
88
{ tutorial . tags &&
76
- tutorial . tags . map ( ( tag ) => < p className = { clsx ( styles . tutorialListTag ) } > { tag } </ p > ) }
89
+ tutorial . tags . map ( ( tag ) => < p key = { tag } className = { clsx ( styles . tutorialListTag ) } > { tag } </ p > ) }
77
90
</ div >
78
91
</ div >
79
- </ Link >
92
+ </ div >
93
+ // </Link>
80
94
) ;
81
95
}
82
96
@@ -130,7 +144,7 @@ export default function Tutorials() {
130
144
. filter ( ( tutorial ) =>
131
145
selectedTag == 'all' ? tutorial : tutorial . tags . includes ( selectedTag ) ,
132
146
)
133
- . map ( ( tutorial ) => < TutorialListCell tutorial = { tutorial } /> ) }
147
+ . map ( ( tutorial ) => < TutorialListCell key = { tutorial . slug } tutorial = { tutorial } /> ) }
134
148
</ div >
135
149
</ div >
136
150
</ div >
0 commit comments