Skip to content

Commit c1f2117

Browse files
authored
Merge pull request #224 from DevKor-github/feat/banner-img
λ””μ½”λ“œ λ°°λ„ˆ 적용 ~
2 parents 5c199b6 + db7f918 commit c1f2117

4 files changed

Lines changed: 43 additions & 26 deletions

File tree

β€Žsrc/features/home/components/Banner/index.tsxβ€Ž

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,10 @@ import { Swiper, SwiperSlide } from 'swiper/react';
33

44
import * as s from './style.css';
55
import { 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

298
const 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}>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import banner1 from '@/libs/assets/external_banner_1.webp';
2+
import banner2 from '@/libs/assets/external_banner_2.webp';
3+
4+
export interface BannerInterface {
5+
title?: string;
6+
description?: string;
7+
author?: string;
8+
src: string;
9+
link?: string;
10+
}
11+
12+
// TODO: μ‹€μ œ API둜 ꡐ체
13+
export const BANNER_DATA: BannerInterface[] = [
14+
{
15+
title: 'de:Kode your Color',
16+
description: 'κ³ μ—°μ „ λ ˆν”Œλ¦¬μΉ΄λ„ λ””μ½”λ“œμ™€ ν•¨κ»˜!',
17+
author: 'de:Kode',
18+
src: banner1,
19+
link: 'https://linktr.ee/eugssmixx',
20+
},
21+
{
22+
title: 'de:Kode your Color',
23+
description: 'κ³ μ—°μ „ λ ˆν”Œλ¦¬μΉ΄λ„ λ””μ½”λ“œμ™€ ν•¨κ»˜!',
24+
author: 'de:Kode',
25+
src: banner2,
26+
link: 'https://linktr.ee/eugssmixx',
27+
},
28+
];
1.11 MB
Loading
1.43 MB
Loading

0 commit comments

Comments
Β (0)