@@ -6,7 +6,6 @@ import type { GuideData } from "../../../../types/guide";
66import category from "@/assets/image/guideNav/category.svg" ;
77import mainboard from "@/assets/image/guideNav/mainboard.svg" ;
88import GuidePartButton from "../GuidePartButton/GuidePartButton" ;
9- import ShowMoreButton from "../ShowMoreButton/ShowMoreButton" ;
109import info from "@/assets/image/info.svg" ;
1110import check from "@/assets/image/check.svg" ;
1211import warning from "@/assets/image/warning.svg" ;
@@ -16,6 +15,7 @@ import { useLayoutEffect, useRef } from "react";
1615import ReactMarkdown from "react-markdown" ;
1716import rehypeHighlight from "rehype-highlight" ;
1817import remarkGfm from "remark-gfm" ;
18+ import scroll from "@/assets/image/icon/scroll.png" ;
1919import "highlight.js/styles/github.css" ;
2020import "../../../../styles/globals/markdown.css" ;
2121
@@ -64,8 +64,7 @@ const partIconMap: Record<string, string> = {
6464} ;
6565
6666export default function ContentArea ( ) {
67- const { selectCategory, contentPart, setContentPart, showMore, setShowMore } =
68- useGuidePart ( ) ;
67+ const { selectCategory, contentPart, setContentPart } = useGuidePart ( ) ;
6968
7069 // useGuideData 훅으로 데이터 가져오기
7170 const { data : allGuides , isLoading, error } = useGuideData ( ) ;
@@ -93,35 +92,30 @@ export default function ContentArea() {
9392 // 이전 ScrollTrigger 인스턴스 정리
9493 ScrollTrigger . getAll ( ) . forEach ( ( trigger ) => trigger . kill ( ) ) ;
9594
96- // showMore가 true일 때만 애니메이션 생성
97- if ( showMore ) {
98- const imageHeight = image . clientHeight ;
99-
100- gsap . fromTo (
101- image ,
102- { opacity : 1 } , //애니메이션 시작 상태
103- {
104- opacity : 0 ,
105- ease : "none" ,
106- scrollTrigger : {
107- trigger : content ,
108- scroller : container ,
109- start : `top ${ imageHeight } px` , //trigger 요소의 top이 scroll 대상의 imageHeight 위치에 도달했을 때 애니메이션 시작
110- end : `+=${ imageHeight } px` ,
111- scrub : true , //스크롤 위치에 따라 애니메이션 진행
112- } ,
113- }
114- ) ;
115- } else {
116- // showMore가 false일 때는 opacity를 1로 리셋
117- gsap . set ( image , { opacity : 1 } ) ;
118- }
95+ // 항상 애니메이션 적용
96+ const imageHeight = image . clientHeight ;
97+
98+ gsap . fromTo (
99+ image ,
100+ { opacity : 1 } , //애니메이션 시작 상태
101+ {
102+ opacity : 0 ,
103+ ease : "none" ,
104+ scrollTrigger : {
105+ trigger : content ,
106+ scroller : container ,
107+ start : `top ${ imageHeight } px` , //trigger 요소의 top이 scroll 대상의 imageHeight 위치에 도달했을 때 애니메이션 시작
108+ end : `+=${ imageHeight } px` ,
109+ scrub : true , //스크롤 위치에 따라 애니메이션 진행
110+ } ,
111+ }
112+ ) ;
119113
120114 // cleanup 함수
121115 return ( ) => {
122116 ScrollTrigger . getAll ( ) . forEach ( ( trigger ) => trigger . kill ( ) ) ;
123117 } ;
124- } , [ showMore , currentData ] ) ;
118+ } , [ currentData ] ) ;
125119
126120 // 로딩 상태 처리
127121 if ( isLoading ) {
@@ -173,7 +167,7 @@ export default function ContentArea() {
173167 </ div >
174168
175169 < div className = { style . contentWrapper } ref = { contentRef } >
176- < div className = { `${ style . content } ${ showMore ? style . showMore : "" } ` } >
170+ < div className = { `${ style . content } ${ style . showMore } ` } >
177171 < div className = { style . title } >
178172 < img src = { iconMap [ displayName ] } alt = "category icon" />
179173 < div className = { style . category } > { displayName } </ div >
@@ -188,12 +182,23 @@ export default function ContentArea() {
188182 isActive = { item . title === contentPart }
189183 onClick = { ( ) => {
190184 setContentPart ( item . title ) ;
191- setShowMore ( false ) ;
192185 } }
193186 />
194187 ) ) }
195188 </ div >
196189 < div className = { style . textContent } >
190+ { contentPart === "주요 특징" && (
191+ < div className = { style . scrollGuide } >
192+ < div className = { style . scrollText } > 아래로 스크롤</ div >
193+ < div className = { style . scrollArrows } >
194+ < img
195+ className = { style . scrollArrow }
196+ src = { scroll }
197+ alt = "scroll arrow"
198+ />
199+ </ div >
200+ </ div >
201+ ) }
197202 < div className = { `${ style . description } markdown-content` } >
198203 < ReactMarkdown
199204 remarkPlugins = { [ remarkGfm ] }
@@ -202,27 +207,22 @@ export default function ContentArea() {
202207 { cleanMarkdown ( currentPart ?. description || "" ) }
203208 </ ReactMarkdown >
204209 </ div >
205- { showMore && (
206- < div className = { style . detail } >
207- { currentPart ?. details . map ( ( detail ) => (
208- < div key = { detail . title } className = { style . detailItem } >
209- < div className = { style . detailItemTitle } > { detail . title } </ div >
210- < div className = { `${ style . detailItemDesc } markdown-content` } >
211- < ReactMarkdown
212- remarkPlugins = { [ remarkGfm ] }
213- rehypePlugins = { [ rehypeHighlight ] }
214- >
215- { cleanMarkdown ( detail . description ) }
216- </ ReactMarkdown >
217- </ div >
210+
211+ < div className = { style . detail } >
212+ { currentPart ?. details . map ( ( detail ) => (
213+ < div key = { detail . title } className = { style . detailItem } >
214+ < div className = { style . detailItemTitle } > { detail . title } </ div >
215+ < div className = { `${ style . detailItemDesc } markdown-content` } >
216+ < ReactMarkdown
217+ remarkPlugins = { [ remarkGfm ] }
218+ rehypePlugins = { [ rehypeHighlight ] }
219+ >
220+ { cleanMarkdown ( detail . description ) }
221+ </ ReactMarkdown >
218222 </ div >
219- ) ) }
220- </ div >
221- ) }
222- < ShowMoreButton
223- isExpanded = { showMore }
224- onClick = { ( ) => setShowMore ( ! showMore ) }
225- />
223+ </ div >
224+ ) ) }
225+ </ div >
226226 </ div >
227227 </ div >
228228 </ div >
0 commit comments