@@ -7,23 +7,26 @@ import Image from 'next/image';
7
7
import { useState } from 'react' ;
8
8
import CaretLeft from 'public/CaretLeft.svg' ;
9
9
import CaretRight from 'public/CaretRight.svg' ;
10
+ import { useRouter } from 'next/navigation' ;
10
11
import FlexBox from '../../FlexBox' ;
11
12
import Divider from '../../Divider' ;
12
13
import Images from './Images' ;
13
14
14
15
export default function BoardCardContent ( {
15
16
children,
16
17
type,
18
+ boardId,
17
19
content,
18
20
imgs,
19
- onClickModal,
20
21
} : {
21
22
children : React . ReactNode ;
22
23
type : 'mainPC' | 'modal' | 'myPage' | 'id' ;
24
+ boardId : number ;
23
25
content : string ;
24
26
imgs : string [ ] ;
25
- onClickModal ?: ( ) => void ;
26
27
} ) {
28
+ const router = useRouter ( ) ;
29
+
27
30
const [ imgNum , setImgNum ] = useState ( 0 ) ;
28
31
const downImgNum = ( ) => {
29
32
if ( imgNum - 1 >= 0 ) {
@@ -49,10 +52,16 @@ export default function BoardCardContent({
49
52
} ${ type === 'modal' && 'w-[375px] h-full' } gap-3`}
50
53
>
51
54
< div
52
- className = { `body3 text-grey-800 ${
55
+ className = { `body3 text-grey-800 w-full ${
53
56
type === 'mainPC' ? 'max-h-40' : null
57
+ } ${
58
+ type === 'mainPC' || type === 'myPage' ? 'hover:cursor-pointer' : null
54
59
} `}
55
- onClick = { onClickModal }
60
+ onClick = { ( ) =>
61
+ type === 'mainPC' || type === 'myPage'
62
+ ? router . push ( `board/${ boardId } ` )
63
+ : null
64
+ }
56
65
>
57
66
{ content }
58
67
</ div >
@@ -68,7 +77,7 @@ export default function BoardCardContent({
68
77
< >
69
78
{ type === 'mainPC' && (
70
79
< div className = "grid w-full h-full grid-cols-2 gap-9" >
71
- < Images imgs = { imgs } onClickModal = { onClickModal } />
80
+ < Images boardId = { boardId } imgs = { imgs } />
72
81
{ renderBoardContent ( ) }
73
82
</ div >
74
83
) }
@@ -99,8 +108,11 @@ export default function BoardCardContent({
99
108
) }
100
109
101
110
{ type === 'myPage' && (
102
- < div className = "grid w-full h-full grid-rows-2 gap-9" >
103
- < Images imgs = { imgs } onClickModal = { onClickModal } />
111
+ < div
112
+ className = "grid w-full h-full grid-rows-2 gap-9"
113
+ onClick = { ( ) => router . push ( `/board/${ boardId } ` ) }
114
+ >
115
+ < Images boardId = { boardId } imgs = { imgs } />
104
116
{ renderBoardContent ( ) }
105
117
</ div >
106
118
) }
0 commit comments