File tree 2 files changed +13
-2
lines changed
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change
1
+ import { useRouter } from 'next/navigation' ;
1
2
import React from 'react' ;
2
3
3
4
const SubscriptionBanner = ( ) => {
5
+ const router = useRouter ( ) ;
6
+
4
7
return (
5
8
< div className = "w-full flex items-center justify-between bg-gradient-to-r from-gray-50 to-gray-100 rounded-2xl px-12 py-16 shadow-md max-w-[1000px] mx-auto mt-12" >
6
9
< div className = "text-left" >
@@ -10,7 +13,8 @@ const SubscriptionBanner = () => {
10
13
</ h2 >
11
14
</ div >
12
15
< div >
13
- < button className = "bg-gradient2 px-8 py-4 rounded-full shadow-md hover:bg-gradient2 text-neutral-50 text-lg font-bold font-['Inter'] transition duration-300 " >
16
+ < button className = "bg-gradient2 px-8 py-4 rounded-full shadow-md hover:bg-gradient2 text-neutral-50 text-lg font-bold font-['Inter'] transition duration-300"
17
+ onClick = { ( ) => router . push ( '/payment' ) } >
14
18
첫달 무료 구독하기
15
19
</ button >
16
20
</ div >
Original file line number Diff line number Diff line change @@ -3,12 +3,14 @@ import { RelatedArticle } from "@/types/learning";
3
3
import Image from "next/image" ;
4
4
import { getRelatedArticles } from "@/factory/Article/GetArticle" ;
5
5
import { getValidImageSrc } from "@/utils/checkImageProperty" ;
6
+ import { useRouter } from "next/navigation" ;
6
7
7
8
interface RelatedArticlesProps {
8
9
articleId : number ;
9
10
}
10
11
11
12
const RelatedArticles = ( { articleId } : RelatedArticlesProps ) => {
13
+ const router = useRouter ( ) ;
12
14
const [ relatedArticles , setRelatedArticles ] = useState < RelatedArticle [ ] | string > ( "" ) ;
13
15
14
16
useEffect ( ( ) => {
@@ -25,6 +27,10 @@ const RelatedArticles = ({ articleId }: RelatedArticlesProps) => {
25
27
fetchData ( ) ;
26
28
} , [ articleId ] ) ;
27
29
30
+ const handleContentClick = ( item : any ) => {
31
+ router . push ( `/learning/detail/${ item . article . articleId } ` ) ;
32
+ } ;
33
+
28
34
// 데이터가 없을 때 처리
29
35
if ( typeof relatedArticles === "string" ) {
30
36
return (
@@ -44,7 +50,8 @@ const RelatedArticles = ({ articleId }: RelatedArticlesProps) => {
44
50
</ h2 >
45
51
< div className = "grid grid-cols-3 gap-4" >
46
52
{ relatedArticles . map ( ( item ) => (
47
- < div key = { item . article . articleId } className = "flex flex-col justify-between h-full" >
53
+ < div key = { item . article . articleId } className = "flex flex-col justify-between h-full cursor-pointer"
54
+ onClick = { ( ) => handleContentClick ( item ) } >
48
55
< div
49
56
className = "w-full relative overflow-hidden rounded-[25px]"
50
57
style = { { aspectRatio : "409 / 255" } }
You can’t perform that action at this time.
0 commit comments