@@ -3,31 +3,10 @@ import { Swiper, SwiperSlide } from 'swiper/react';
33
44import * as s from './style.css' ;
55import { useState } from 'react' ;
6-
7- // TODO: μ€μ APIλ‘ κ΅μ²΄
8- const MOCK_DATA = [
9- {
10- title : 'μ λ°°κ³ νλ€ μ‘ν λ¨Ήκ³ μΆλ€' ,
11- description : 'κ°μ₯ μλ
κ³ μΆμ₯ μλ
' ,
12- author : 'κΉμΉ' ,
13- src : 'https://github.com/user-attachments/assets/66bed657-d8a9-464a-9d9a-f9647028c1d7' ,
14- } ,
15- {
16- title : 'ν 리ν
λΆμΉ΄μΌ μ°λ' ,
17- description : 'μμ°νκΉ μΆκ°' ,
18- author : 'νΈλμ΄' ,
19- src : 'https://www.skyweaver.net/images/media/wallpapers/wallpaper1.jpg' ,
20- } ,
21- {
22- title : 'μ΄λ»κ² μΌμμΈλΌ λΆλ' ,
23- description : 'μ€λ νμμ λκ°μ' ,
24- author : 'μ΄λ°λ€λΌλ§μ€' ,
25- src : 'https://t3.ftcdn.net/jpg/05/64/82/08/360_F_564820811_n9WP1mM43pLiQwLkIA07KF9Hat5vkX2v.jpg' ,
26- } ,
27- ] ;
6+ import { BANNER_DATA } from '@/features/home/constants' ;
287
298const Banner = ( ) => {
30- const [ data ] = useState ( MOCK_DATA ) ;
9+ const [ data ] = useState ( BANNER_DATA ) ;
3110 const totalIndex = data . length ;
3211 const [ currentIndex , setCurrentIndex ] = useState ( 0 ) ;
3312
@@ -47,7 +26,13 @@ const Banner = () => {
4726 >
4827 { data . map ( ( item , index ) => (
4928 < SwiperSlide key = { `${ item . title } -${ index } ` } >
50- < img className = { s . Image } src = { item . src } alt = { item . title } />
29+ { item . link ? (
30+ < a href = { item . link } target = "_blank" rel = "noopener noreferrer" >
31+ < img className = { s . Image } src = { item . src } alt = { item . title } />
32+ </ a >
33+ ) : (
34+ < img className = { s . Image } src = { item . src } alt = { item . title } />
35+ ) }
5136 </ SwiperSlide >
5237 ) ) }
5338 </ Swiper >
@@ -57,8 +42,12 @@ const Banner = () => {
5742 < div className = { s . Title } > { currentData . title } </ div >
5843 < div className = { s . DescriptionWrapper } >
5944 < span > { currentData . description } </ span >
60- < span className = { s . Dot } />
61- < span > { currentData . author } </ span >
45+ { currentData . author && (
46+ < >
47+ < span className = { s . Dot } />
48+ < span > { currentData . author } </ span >
49+ </ >
50+ ) }
6251 </ div >
6352 </ div >
6453 < div className = { s . Fraction } >
0 commit comments