1- import style from './contentArea.module.css'
2- import React from 'react'
3- import categoryImg from '@/assets/image/guideImg.png'
4- import { useGuidePart } from '../../../../stores/useGuidePart' ;
1+ import style from "./contentArea.module.css" ;
2+ import categoryImg from "@/assets/image/guideImg.png" ;
3+ import { useGuidePart } from "../../../../stores/useGuidePart" ;
54import data from "../../../../dummy/dummy_guide.json" ;
6- import category from ' @/assets/image/guideNav/category.svg' ;
7- import mainboard from ' @/assets/image/guideNav/mainboard.svg' ;
8- import GuidePartButton from ' ../guidePartButton/guidePartButton' ;
9- import info from ' @/assets/image/info.svg'
10- import check from ' @/assets/image/check.svg'
11- import warning from ' @/assets/image/warning.svg'
12- import dropdown from ' @/assets/image/dropdown.svg'
5+ import category from " @/assets/image/guideNav/category.svg" ;
6+ import mainboard from " @/assets/image/guideNav/mainboard.svg" ;
7+ import GuidePartButton from " ../guidePartButton/guidePartButton" ;
8+ import info from " @/assets/image/info.svg" ;
9+ import check from " @/assets/image/check.svg" ;
10+ import warning from " @/assets/image/warning.svg" ;
11+ import dropdown from " @/assets/image/dropdown.svg" ;
1312
1413const iconMap : Record < string , string > = {
1514 CPU : category ,
@@ -18,68 +17,76 @@ const iconMap: Record<string, string> = {
1817 "그래픽 카드" : category ,
1918 "저장 장치" : category ,
2019 "파워 서플라이" : category ,
21- " 케이스" : category ,
20+ 케이스 : category ,
2221 "쿨러/팬" : category ,
2322 "기타 입출력 장치" : category ,
2423} ;
2524
2625const imageMap : Record < string , string > = {
27- CPU : categoryImg ,
26+ CPU : categoryImg ,
2827 메인보드 : categoryImg ,
2928 RAM : categoryImg ,
3029 "그래픽 카드" : categoryImg ,
3130 "저장 장치" : categoryImg ,
3231 "파워 서플라이" : categoryImg ,
33- " 케이스" : categoryImg ,
32+ 케이스 : categoryImg ,
3433 "쿨러/팬" : categoryImg ,
3534 "기타 입출력 장치" : categoryImg ,
3635} ;
3736
38- const partIconMap : Record < string , string > = {
39- 개요 : info ,
40- "주요 특징" : check ,
41- " 유의사항" : warning ,
42- "초보자용 설명" : warning
43- }
37+ const partIconMap : Record < string , string > = {
38+ 개요 : info ,
39+ "주요 특징" : check ,
40+ 유의사항 : warning ,
41+ "초보자용 설명" : warning ,
42+ } ;
4443
45- export default function ContentArea ( ) {
46- const { selectCategory, contentPart, setContentPart } = useGuidePart ( ) ;
47- const currentData = data . find ( item => item . category === selectCategory ) ;
44+ export default function ContentArea ( ) {
45+ const { selectCategory, contentPart, setContentPart } = useGuidePart ( ) ;
46+ const currentData = data . find ( ( item ) => item . category === selectCategory ) ;
4847
49- if ( ! currentData ) {
50- return < div > 오류 발생</ div > ;
51- }
48+ if ( ! currentData ) {
49+ return < div > 오류 발생</ div > ;
50+ }
5251
53- const currentPart = currentData . content . find ( item => item . title === contentPart )
52+ const currentPart = currentData . content . find (
53+ ( item ) => item . title === contentPart
54+ ) ;
5455
55- return (
56- < div className = { style . container } >
57- < img src = { imageMap [ selectCategory ] } alt = "category icon" className = { style . categoryImg } />
58- < div className = { style . content } >
59- < div className = { style . title } >
60- < img src = { iconMap [ selectCategory ] } alt = "category icon" />
61- < div className = { style . category } > { selectCategory } </ div >
62- < div className = { style . order } > 조립순서 #{ currentData . id } </ div >
63- </ div >
64- < div className = { style . btnContainer } >
65- { currentData . content . map ( ( item ) => (
66- < GuidePartButton
67- key = { item . title }
68- img = { partIconMap [ item . title ] }
69- content = { item . title }
70- isActive = { item . title === contentPart }
71- onClick = { ( ) => { setContentPart ( item . title ) } }
72- />
73- ) ) }
74- </ div >
75- < div className = { style . textContent } >
76- < div className = { style . text } > { currentPart ?. text } </ div >
77- < div className = { style . btn } >
78- < span > 자세히보기</ span >
79- < img src = { dropdown } alt = "dropdown" />
80- </ div >
81- </ div >
82- </ div >
56+ return (
57+ < div className = { style . container } >
58+ < img
59+ src = { imageMap [ selectCategory ] }
60+ alt = "category icon"
61+ className = { style . categoryImg }
62+ />
63+ < div className = { style . content } >
64+ < div className = { style . title } >
65+ < img src = { iconMap [ selectCategory ] } alt = "category icon" />
66+ < div className = { style . category } > { selectCategory } </ div >
67+ < div className = { style . order } > 조립순서 #{ currentData . id } </ div >
68+ </ div >
69+ < div className = { style . btnContainer } >
70+ { currentData . content . map ( ( item ) => (
71+ < GuidePartButton
72+ key = { item . title }
73+ img = { partIconMap [ item . title ] }
74+ content = { item . title }
75+ isActive = { item . title === contentPart }
76+ onClick = { ( ) => {
77+ setContentPart ( item . title ) ;
78+ } }
79+ />
80+ ) ) }
8381 </ div >
84- )
85- }
82+ < div className = { style . textContent } >
83+ < div className = { style . text } > { currentPart ?. text } </ div >
84+ < div className = { style . btn } >
85+ < span > 자세히보기</ span >
86+ < img src = { dropdown } alt = "dropdown" />
87+ </ div >
88+ </ div >
89+ </ div >
90+ </ div >
91+ ) ;
92+ }
0 commit comments