@@ -222,42 +222,47 @@ const Item = memo<{
222
222
const router = useRouter ( )
223
223
const isMobile = useIsMobile ( )
224
224
const { present } = useModalStack ( )
225
- const handlePeek = useCallback ( ( e : SyntheticEvent ) => {
226
- if ( item . type === ArticleType . Note ) {
227
- {
225
+
226
+ const handlePeek = useCallback (
227
+ ( e : SyntheticEvent ) => {
228
+ if ( isMobile ) return
229
+ if ( item . type === ArticleType . Note ) {
230
+ {
231
+ e . preventDefault ( )
232
+ present ( {
233
+ clickOutsideToDismiss : true ,
234
+ title : 'Preview' ,
235
+ modalClassName : 'flex justify-center' ,
236
+ modalContainerClassName : 'flex justify-center' ,
237
+ CustomModalComponent : ( ) => (
238
+ < PeekModal to = { item . href } >
239
+ < NotePreview noteId = { parseInt ( item . href . split ( '/' ) . pop ( ) ! ) } />
240
+ </ PeekModal >
241
+ ) ,
242
+ content : ( ) => null ,
243
+ } )
244
+ }
245
+ } else if ( item . type === ArticleType . Post ) {
228
246
e . preventDefault ( )
247
+ const splitpath = item . href . split ( '/' )
248
+ const slug = splitpath . pop ( ) !
249
+ const category = splitpath . pop ( ) !
229
250
present ( {
230
251
clickOutsideToDismiss : true ,
231
252
title : 'Preview' ,
232
253
modalClassName : 'flex justify-center' ,
233
254
modalContainerClassName : 'flex justify-center' ,
234
255
CustomModalComponent : ( ) => (
235
256
< PeekModal to = { item . href } >
236
- < NotePreview noteId = { parseInt ( item . href . split ( '/' ) . pop ( ) ! ) } />
257
+ < PostPreview category = { category } slug = { slug } />
237
258
</ PeekModal >
238
259
) ,
239
260
content : ( ) => null ,
240
261
} )
241
262
}
242
- } else if ( item . type === ArticleType . Post ) {
243
- e . preventDefault ( )
244
- const splitpath = item . href . split ( '/' )
245
- const slug = splitpath . pop ( ) !
246
- const category = splitpath . pop ( ) !
247
- present ( {
248
- clickOutsideToDismiss : true ,
249
- title : 'Preview' ,
250
- modalClassName : 'flex justify-center' ,
251
- modalContainerClassName : 'flex justify-center' ,
252
- CustomModalComponent : ( ) => (
253
- < PeekModal to = { item . href } >
254
- < PostPreview category = { category } slug = { slug } />
255
- </ PeekModal >
256
- ) ,
257
- content : ( ) => null ,
258
- } )
259
- }
260
- } , [ ] )
263
+ } ,
264
+ [ isMobile ] ,
265
+ )
261
266
return (
262
267
< li
263
268
key = { item . id }
0 commit comments