1+ import instance from "@/api/axios" ;
12import Header from "@/components/Header" ;
23import React from "react" ;
34import { useParams } from "react-router-dom" ;
@@ -9,18 +10,18 @@ const contentData = [
910 image : {
1011 sm : "/image/home_banner1_sm.png" ,
1112 md : "/image/home_banner1_md.png" ,
12- lg : "/image/home_banner1_lg.png" ,
13+ lg : "/image/home_banner1_lg.png"
1314 } ,
1415 subTitle : "" ,
15- content : "" ,
16+ content : ""
1617 } ,
1718 {
1819 id : 1 ,
1920 title : "썸탈 때 대화주제 추천 MBTI별 대백과" ,
2021 image : {
2122 sm : "/image/home_banner2_sm.png" ,
2223 md : "/image/home_banner2_md.png" ,
23- lg : "/image/home_banner2_lg.png" ,
24+ lg : "/image/home_banner2_lg.png"
2425 } ,
2526 subTitle : "썸탈 때 대화주제 추천(MBTI별)" ,
2627 content : `썸 탈 때 이런 주제를 활용해보세요! MBTI 별로 추천드려요. 조금 더 자세한 대화주제 추천을 원한다면? 대화를 시작해보세요~
@@ -87,15 +88,15 @@ const contentData = [
8788
8889 ENTJ (결단력 있는 지휘관):
8990 - "회사에서 좋은 리더란 어떤 리더일까?"
90- - 설명: 전략적 사고나 리더십에 대한 이야기를 나누는 것을 좋아해요!` ,
91+ - 설명: 전략적 사고나 리더십에 대한 이야기를 나누는 것을 좋아해요!`
9192 } ,
9293 {
9394 id : 2 ,
9495 title : "MBTI별 피해야 할 대화스타일 및 주제" ,
9596 image : {
9697 sm : "/image/home_banner3_sm.png" ,
9798 md : "/image/home_banner3_md.png" ,
98- lg : "/image/home_banner3_lg.png" ,
99+ lg : "/image/home_banner3_lg.png"
99100 } ,
100101 subTitle : "MBTI 별 피해야할 대화스타일 & 주제" ,
101102 content : `MBTI 별로 피해야 하는 대화 스타일, 주제를 알아보아요!
@@ -162,66 +163,73 @@ const contentData = [
162163
163164 ENTJ (결단력 있는 지휘관):
164165 - 비효율적이거나 비논리적인 대화.
165- - 예시 : 목표 달성을 방해하는 비효율적인 논의나, 감정적인 요소를 과도하게 강조하는 것.` ,
166- } ,
166+ - 예시 : 목표 달성을 방해하는 비효율적인 논의나, 감정적인 요소를 과도하게 강조하는 것.`
167+ }
167168] ;
168169
169170const Content = ( ) => {
170171 const { id } = useParams < { id : string } > ( ) ;
171172 const content = contentData [ Number ( id ) ] ;
172173
173174 if ( ! content ) {
174- return < div className = "text-center mt-10" > Content not found</ div > ;
175+ return < div className = "mt-10 text-center " > Content not found</ div > ;
175176 }
176177
177-
178- const handleStartChat = ( ) => {
179- alert ( "API 호출" ) ;
180- }
178+ const handleStartChat = async ( ) => {
179+ try {
180+ const response = await instance . post ( "api/fast-friend" ) ;
181+ console . log ( "Success!!" , response . data ) ;
182+ } catch ( error ) {
183+ console . error ( "Select Info Error" , error ) ;
184+ }
185+ } ;
181186
182187 const renderContentWithLineBreaks = ( text : string ) => {
183- return text . split ( "\n" ) . map ( ( line , index ) => (
184- < React . Fragment key = { index } >
185- { line . trim ( ) ? < p > { line } </ p > : < br /> }
186- </ React . Fragment >
187- ) ) ;
188+ return text
189+ . split ( "\n" )
190+ . map ( ( line , index ) => (
191+ < React . Fragment key = { index } >
192+ { line . trim ( ) ? < p > { line } </ p > : < br /> }
193+ </ React . Fragment >
194+ ) ) ;
188195 } ;
189196
190197 return (
191198 < div className = "flex w-[360px] flex-col bg-white md:w-[375px] lg:w-[500px]" >
192199 < Header title = "상대방 정보선택" />
193200
194- < div className = "px-5 py-5 flex flex-col gap-[36px]" >
195-
201+ < div className = "flex flex-col gap-[36px] px-5 py-5" >
196202 { /* 상단 배너 */ }
197- < div className = "relative bg-gray-100 rounded-[16px] overflow-hidden " >
203+ < div className = "relative overflow-hidden rounded-[16px] bg-gray-100 " >
198204 < picture >
199205 < source media = "(min-width: 500px)" srcSet = { content . image . lg } />
200206 < source media = "(min-width: 375px)" srcSet = { content . image . md } />
201207 < img
202208 src = { content . image . sm }
203209 alt = { content . title }
204- className = "w-full h-[156px] object-cover"
210+ className = "h-[156px] w-full object-cover"
205211 />
206212 </ picture >
207213 </ div >
208214
209215 { /* 서브 제목 */ }
210216 { content . subTitle && (
211- < h2 className = "font-bold text-[18px] leading-[27px] tracking[-0.01em] text-gray-900" > { content . subTitle } </ h2 >
217+ < h2 className = "tracking[-0.01em] text-[18px] leading-[27px] font-bold text-gray-900" >
218+ { content . subTitle }
219+ </ h2 >
212220 ) }
213221
214222 { /* 본문 내용 */ }
215- < div className = "font-medium text-lg leading-6 tracking-norma text-gray-900 mb-[1px] " >
223+ < div className = "tracking-norma mb-[1px] text-lg leading-6 font-medium text-gray-900" >
216224 { content . content && renderContentWithLineBreaks ( content . content ) }
217225 </ div >
218226
219227 { /* 하단 버튼 */ }
220228 < button
221- className = "w-full my-[22px] h-[60px] bg-primary-normal text-white rounded-[8px] font-bold"
222- onClick = { handleStartChat }
229+ className = "my-[22px] h-[60px] w-full rounded-[8px] bg-primary-normal font-bold text-white "
230+ onClick = { handleStartChat }
223231 >
224- 대화 시작하기
232+ 대화 시작하기
225233 </ button >
226234 </ div >
227235 </ div >
0 commit comments