@@ -7,6 +7,10 @@ import ArticleDetailContent from '@/components/learning/article/ArticleDetailCon
7
7
import { getArticleDetail } from '@/factory/Article/GetArticle' ;
8
8
import { ArticleDetail } from '@/types/learning' ;
9
9
import { useAuthStore } from '@/store/userAuth.store' ;
10
+ import Image from 'next/image' ;
11
+ import sharedIcon from '../../../../public/images/learning/articleShare.svg' ;
12
+ import likedIcon from '../../../../public/images/learning/articleLiked.svg' ;
13
+ import RelatedArticles from './RelatedArticles' ;
10
14
11
15
interface ArticleDetailClientWrapperProps {
12
16
articleId : number ;
@@ -40,6 +44,16 @@ const ArticleDetailClientWrapper = ({ articleId }: ArticleDetailClientWrapperPro
40
44
return null ;
41
45
}
42
46
47
+ const handleShare = async ( ) => {
48
+ const shareUrl = `${ window . location . origin } /learning/detail/${ articleId } ` ;
49
+ try {
50
+ await navigator . clipboard . writeText ( shareUrl ) ;
51
+ alert ( 'URL이 복사되었습니다!' ) ;
52
+ } catch ( error ) {
53
+ console . error ( 'URL 복사 중 오류 발생:' , error ) ;
54
+ }
55
+ } ;
56
+
43
57
return (
44
58
< div >
45
59
< ArticleDetailHeader
@@ -49,14 +63,41 @@ const ArticleDetailClientWrapper = ({ articleId }: ArticleDetailClientWrapperPro
49
63
authorName = { data . authorName }
50
64
imgLink = { data . imgLink }
51
65
/>
52
- < div className = "max-w-[1000px] mx-auto my-6 text-sm text-gray-600" >
53
- 학습하기 > 아티클 > { data . categoryName }
66
+ { /* todo: 화면 크기 작아지면 텍스트 영역 겹치는 부분 */ }
67
+ < div className = "w-[90%] mx-auto py-12 flex items-center justify-between border-b border-[#ececec]" >
68
+ < div className = "text-sm text-[#a0a0a0]" >
69
+ 학습하기 > 아티클 > { data . categoryName }
70
+ </ div >
71
+ < div className = "absolute inset-x-0 text-center" >
72
+ < h1 className = "text-lg font-semibold text-[#777777]" > { data . title } </ h1 >
73
+ </ div >
74
+ < div className = "flex items-center gap-4 z-[9999]" >
75
+ < Image
76
+ src = { likedIcon }
77
+ alt = "좋아요 아이콘"
78
+ width = { 24 }
79
+ height = { 24 }
80
+ className = "cursor-pointer"
81
+ />
82
+ < button onClick = { handleShare } aria-label = "공유하기" >
83
+ < Image
84
+ src = { sharedIcon }
85
+ alt = "공유 아이콘"
86
+ width = { 24 }
87
+ height = { 24 }
88
+ className = "cursor-pointer"
89
+ />
90
+ </ button >
91
+ </ div >
54
92
</ div >
55
93
< ArticleDetailContent
56
94
text = { data . text }
95
+ title = { data . title }
57
96
createdAt = { data . createdAt }
58
97
authorName = { data . authorName }
98
+ imgLink = { data . imgLink }
59
99
/>
100
+ < RelatedArticles articleId = { articleId } />
60
101
</ div >
61
102
) ;
62
103
} ;
0 commit comments