Skip to content

Commit 75b6888

Browse files
authored
Merge pull request #212 from Moaguide-develop/feat/articleDetail
feat : 아티클 페이지 카테고리 별 이미지 처리
2 parents 998c5e4 + 5e75e55 commit 75b6888

11 files changed

+74
-9
lines changed
1.21 MB
Loading
1.08 MB
Loading
1.59 MB
Loading
2.17 MB
Loading
3.44 MB
Loading
191 KB
Loading
1.33 MB
Loading
1.39 MB
Loading

src/components/learning/FilteredContents.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ const FilteredContents = ({
124124
);
125125
})
126126
) : (
127-
<div className="text-center text-gray-500">데이터가 없습니다.</div>
127+
<div className="text-center text-gray-500">콘텐츠 준비중입니다.</div>
128128
)}
129129
</div>
130130

src/components/learning/LearningPageClient.tsx

+16-8
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import LatestNewsClipping from '@/components/learning/LatestNewsClipping';
99
import FilteredContents from '@/components/learning/FilteredContents';
1010
import HomeIcon from '../../../public/images/learning/learning_home.svg';
1111
import ArrowIcon from '../../../public/images/learning/bottom_arrow_button.svg';
12-
import BackgroundImage from '../../../public/images/learning/learning_background.png';
1312
import SubscriptionBanner from './SubscriptionBanner';
1413
import { dropdownOptions } from '@/utils/dropdownOptions';
1514
import { OverviewResponse, Content } from '@/types/learning';
1615
import { fetchContentsWithPage } from '@/factory/Article/GetArticle';
1716
import { resetSessionValues } from '@/utils/resetSessionValues';
17+
import { categoryConfig } from '@/utils/categoryConfig';
1818

1919
const LearningPageClient = ({ initialData }: { initialData: OverviewResponse }) => {
2020

@@ -81,17 +81,25 @@ const LearningPageClient = ({ initialData }: { initialData: OverviewResponse })
8181
likedByMe: item.likedByMe,
8282
}))
8383
: [];
84+
85+
const categoryInfo = categoryConfig[selectedCategory as keyof typeof categoryConfig] || categoryConfig.all;
86+
8487

8588
return (
8689
<div>
8790
<div className="hidden sm:flex relative w-full h-[300px] lg:h-[400px]">
88-
<Image
89-
src={BackgroundImage}
90-
alt="Background"
91-
layout="fill"
92-
objectFit="cover"
93-
className="w-full"
94-
/>
91+
<Image
92+
src={categoryInfo.backgroundImage}
93+
alt="Background"
94+
layout="fill"
95+
objectFit="cover"
96+
className="w-full"
97+
/>
98+
<div className="absolute inset-0 bg-black opacity-30"></div>
99+
<div className="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-center">
100+
<h2 className="text-white text-3xl font-bold">{categoryInfo.title}</h2>
101+
<p className="text-white text-lg mt-2">{categoryInfo.description}</p>
102+
</div>
95103
<div className="absolute bottom-0 left-0 right-0 flex justify-end items-center border-b shadow-sm z-50 bg-[#fffffc]/50">
96104
<button
97105
onClick={resetFilters}

src/utils/categoryConfig.ts

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import NewsBackground from '../../public/images/learning/news_background.png';
2+
import GuideBackground from '../../public/images/learning/guide_background.png';
3+
import BuildingBackground from '../../public/images/learning/building_background.png';
4+
import ArtBackground from '../../public/images/learning/art_background.png';
5+
import MusicBackground from '../../public/images/learning/music_background.png';
6+
import ContentBackground from '../../public/images/learning/content_background.png';
7+
import CowBackground from '../../public/images/learning/cow_background.png';
8+
import MoneyBackground from '../../public/images/learning/money_background.png';
9+
import DefaultBackground from '../../public/images/learning/learning_background.png';
10+
11+
export const categoryConfig = {
12+
all: {
13+
title: '학습하기',
14+
backgroundImage: DefaultBackground,
15+
description: '다양한 학습 콘텐츠를 탐색해보세요.',
16+
},
17+
news: {
18+
title: '오늘의 뉴스',
19+
backgroundImage: NewsBackground,
20+
description: '오늘의 뉴스 소식을 확인해보세요',
21+
},
22+
guide: {
23+
title: '조각투자 기초 가이드',
24+
backgroundImage: GuideBackground,
25+
description: '조각투자 기초 가이드 소식을 확인해보세요',
26+
},
27+
building: {
28+
title: '부동산',
29+
backgroundImage: BuildingBackground,
30+
description: '부동산 소식을 확인해보세요',
31+
},
32+
art: {
33+
title: '미술품',
34+
backgroundImage: ArtBackground,
35+
description: '미술품 소식을 확인해보세요',
36+
},
37+
music: {
38+
title: '음악 저작권',
39+
backgroundImage: MusicBackground,
40+
description: '음악 저작권 소식을 확인해보세요',
41+
},
42+
content: {
43+
title: '콘텐츠',
44+
backgroundImage: ContentBackground,
45+
description: '콘텐츠 소식을 확인해보세요',
46+
},
47+
cow: {
48+
title: '한우',
49+
backgroundImage: CowBackground,
50+
description: '한우 소식을 확인해보세요',
51+
},
52+
money: {
53+
title: '재테크 가이드',
54+
backgroundImage: MoneyBackground,
55+
description: '재테크 가이드 소식을 확인해보세요',
56+
},
57+
};

0 commit comments

Comments
 (0)