@@ -7,51 +7,66 @@ import useLayoutSize from "@/hooks/useLayoutSize";
77import Header from "@/components/header/Header" ;
88
99const MbtiTestResult = ( ) => {
10+ const mbti = localStorage . getItem ( "mbti-test-mbti" ) ?? "" ;
11+ const result = MBTI_RESULT_INFO [ mbti as keyof typeof MBTI_RESULT_INFO ] ;
12+ const size = useLayoutSize ( ) ;
13+ const imageURL =
14+ size === "sm"
15+ ? `/image/mbti-test/360px/image_${ mbti ?. toLocaleLowerCase ( ) } _360.png`
16+ : size === "md"
17+ ? `/image/mbti-test/375px/image_${ mbti ?. toLocaleLowerCase ( ) } _375.png`
18+ : `/image/mbti-test/500px/image_${ mbti ?. toLocaleLowerCase ( ) } _500.png` ;
1019
11- const mbti = localStorage . getItem ( "mbti-test-mbti" ) ;
12- const result = MBTI_RESULT_INFO [ mbti as keyof typeof MBTI_RESULT_INFO ] ;
13- const size = useLayoutSize ( ) ;
14- const imageURL = size === "sm" ? `/image/mbti-test/360px/image_${ mbti ?. toLocaleLowerCase ( ) } _360.png` : ( size === "md" ? `/image/mbti-test/375px/image_${ mbti ?. toLocaleLowerCase ( ) } _375.png` : `/image/mbti-test/500px/image_${ mbti ?. toLocaleLowerCase ( ) } _500.png` ) ;
15- console . log ( imageURL ) ;
16-
17- const handleClick = ( e : MouseEvent ) => {
18- e . preventDefault ( ) ;
19- }
20+ if ( ! result ) return < div > 404 error occured</ div > ;
2021
21- if ( ! result ) return < div > 404 error occured</ div > ;
22-
23- return (
24- < div className = "flex flex-col sm:w-[360px] md:w-[375px] lg:w-[500px] h-[1008px]" >
25- < Header title = "결과" showShareIcon = { false } />
26- < main className = "flex flex-col flex-grow items-center w-full px-5 bg-white h-screen py-5" >
27- < img src = { imageURL } alt = "mbti 테스트 결과 이미지" className = "sm:w-[320px] md:w-[335px] lg:w-[460px] h-[292px]" />
28- < h2 className = "mt-6 font-bold text-2xl" > { mbti ?. toUpperCase ( ) } 는 이런 성향이에요!</ h2 >
29- < ul className = "flex gap-3 mt-4" >
30- < li style = { { backgroundColor : result . bgColor , color : result . textColor } } className = "px-4 py-1 rounded-[40px] font-bold" > { result . tag [ 0 ] } </ li >
31- < li style = { { backgroundColor : result . bgColor , color : result . textColor } } className = "px-4 py-1 rounded-[40px] font-bold" > { result . tag [ 1 ] } </ li >
32- </ ul >
33- < div className = "flex flex-col bg-white mt-4 p-[28px] border-[#EDEDED] border-1 rounded-[20px]" >
34- < h3 className = "font-bold text-lg" > 좋아하는 대화 주제</ h3 >
35- < ul className = "ml-5 list-disc" >
36- < li > { result . topic [ 0 ] } </ li >
37- < li > { result . topic [ 1 ] } </ li >
38- </ ul >
39- < h3 className = "mt-6 font-bold text-lg" > 좋아하는 대화 태도</ h3 >
40- < ul className = "ml-5 list-disc" >
41- < li > { result . attitude [ 0 ] } </ li >
42- < li > { result . attitude [ 1 ] } </ li >
43- </ ul >
44- </ div >
45- < div className = "mt-[22px] w-full" >
46- < ChatStartButton mode = { "go-virtual" } />
47- </ div >
48- < div className = "flex gap-4 mt-5 w-full" >
49- < RestartButton />
50- < ShareButton />
51- </ div >
52- </ main >
22+ return (
23+ < div className = "flex h-[1008px] flex-col sm:w-[360px] md:w-[375px] lg:w-[500px]" >
24+ < Header title = "결과" showShareIcon = { false } />
25+ < main className = "flex h-screen w-full flex-grow flex-col items-center bg-white px-5 py-5" >
26+ < img
27+ src = { imageURL }
28+ alt = "mbti 테스트 결과 이미지"
29+ className = "h-[292px] sm:w-[320px] md:w-[335px] lg:w-[460px]"
30+ />
31+ < h2 className = "mt-6 text-2xl font-bold" >
32+ { mbti ?. toUpperCase ( ) } 는 이런 성향이에요!
33+ </ h2 >
34+ < ul className = "mt-4 flex gap-3" >
35+ < li
36+ style = { { backgroundColor : result . bgColor , color : result . textColor } }
37+ className = "rounded-[40px] px-4 py-1 font-bold"
38+ >
39+ { result . tag [ 0 ] }
40+ </ li >
41+ < li
42+ style = { { backgroundColor : result . bgColor , color : result . textColor } }
43+ className = "rounded-[40px] px-4 py-1 font-bold"
44+ >
45+ { result . tag [ 1 ] }
46+ </ li >
47+ </ ul >
48+ < div className = "mt-4 flex flex-col rounded-[20px] border-1 border-[#EDEDED] bg-white p-[28px]" >
49+ < h3 className = "text-lg font-bold" > 좋아하는 대화 주제</ h3 >
50+ < ul className = "ml-5 list-disc" >
51+ < li > { result . topic [ 0 ] } </ li >
52+ < li > { result . topic [ 1 ] } </ li >
53+ </ ul >
54+ < h3 className = "mt-6 text-lg font-bold" > 좋아하는 대화 태도</ h3 >
55+ < ul className = "ml-5 list-disc" >
56+ < li > { result . attitude [ 0 ] } </ li >
57+ < li > { result . attitude [ 1 ] } </ li >
58+ </ ul >
59+ </ div >
60+ < div className = "mt-[22px] w-full" >
61+ < ChatStartButton mode = { "go-fast" } mbti = { mbti } />
62+ </ div >
63+ < div className = "mt-5 flex w-full gap-4" >
64+ < RestartButton />
65+ < ShareButton />
5366 </ div >
54- ) ;
55- }
67+ </ main >
68+ </ div >
69+ ) ;
70+ } ;
5671
57- export default MbtiTestResult ;
72+ export default MbtiTestResult ;
0 commit comments