@daeryun/dr_components 1.3.49 → 1.3.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/page/Blog/Blog.jsx +76 -56
- package/dist/components/page/Blog/Blog.tsx +113 -110
- package/dist/components/page/Blog/BlogList.d.ts +19 -0
- package/dist/components/page/Blog/BlogList.jsx +72 -0
- package/dist/components/page/Blog/BlogList.tsx +152 -0
- package/dist/components/page/Blog/BlogTypes.d.ts +11 -10
- package/dist/components/page/Blog/BlogTypes.ts +14 -2
- package/dist/components/page/Blog/BlogView.jsx +33 -29
- package/dist/components/page/Blog/BlogView.tsx +69 -78
- package/dist/components/page/index.d.ts +1 -0
- package/dist/components/page/index.js +1 -0
- package/dist/components/page/index.ts +1 -0
- package/dist/styles/globals.css +19 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -18,10 +18,10 @@ import Image from 'next/image';
|
|
|
18
18
|
import Arrow from '../../../asset/images/success_new/left.webp';
|
|
19
19
|
import RightArrow from '../../../asset/images/success_new/right.webp';
|
|
20
20
|
const Blog = ({ data, tel }) => {
|
|
21
|
-
const { template, contentsList, h2List, fieldData, successData, referenceLinkList, newsLinkList, shortsLinkList, youtubeLinkList, initialData,
|
|
21
|
+
const { template, contentsList, h2List, fieldData, successData, referenceLinkList, newsLinkList, shortsLinkList, youtubeLinkList, initialData, pnData } = data;
|
|
22
22
|
const { width } = useBrowser(true);
|
|
23
|
-
const [isFaqActive, setIsFaqActive] = useState(false);
|
|
24
23
|
const printRef = useRef(null);
|
|
24
|
+
const [faqElementMaxCountInContents, setFaqElementMaxCountInContents] = useState(0);
|
|
25
25
|
const h1Title = template
|
|
26
26
|
.map(temp => temp.tag === 'h1' && temp.tag_title)
|
|
27
27
|
.filter(temp => temp !== false)
|
|
@@ -42,45 +42,60 @@ const Blog = ({ data, tel }) => {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
const handleFaqItemType = (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
if (isFaqActive && faqElementMaxCountInContents >= 2) {
|
|
45
|
+
const handleFaqItemType = () => {
|
|
46
|
+
// 작성자 FAQPage가 1개일 때만 루트 FAQPage를 제거한다.
|
|
47
|
+
if (faqElementMaxCountInContents === 1) {
|
|
50
48
|
return undefined;
|
|
51
49
|
}
|
|
52
50
|
return 'https://schema.org/FAQPage';
|
|
53
51
|
};
|
|
54
|
-
const handleFaqItemScope = (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
if (isFaqActive && faqElementMaxCountInContents >= 2) {
|
|
52
|
+
const handleFaqItemScope = () => {
|
|
53
|
+
// 작성자 FAQPage가 1개일 때만 루트 FAQPage를 제거한다.
|
|
54
|
+
if (faqElementMaxCountInContents === 1) {
|
|
59
55
|
return undefined;
|
|
60
56
|
}
|
|
61
57
|
return true;
|
|
62
58
|
};
|
|
63
59
|
const convertFaqItemType = (template) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
// 작성자 FAQPage가 2개 이상이면 내부 FAQPage를 지우고 루트 FAQPage 1개만 유지한다.
|
|
61
|
+
if (faqElementMaxCountInContents) {
|
|
62
|
+
if (faqElementMaxCountInContents >= 2) {
|
|
63
|
+
const convertedDescription = template.description
|
|
64
|
+
.replaceAll('<div itemscope="" itemtype="https://schema.org/FAQPage">', '<div>')
|
|
65
|
+
.replaceAll('<div itemscope="" itemtype="https://schema.org/FAQPage">', '<div>');
|
|
66
|
+
return Object.assign(Object.assign({}, template), { description: convertedDescription });
|
|
67
|
+
}
|
|
68
68
|
}
|
|
69
|
-
return template;
|
|
69
|
+
return Object.assign({}, template);
|
|
70
70
|
};
|
|
71
|
+
// template, h2List 순회
|
|
71
72
|
useEffect(() => {
|
|
72
73
|
if (template) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
setIsFaqActive(true);
|
|
74
|
+
template.forEach(data => {
|
|
75
|
+
if (data.description) {
|
|
76
|
+
data.faqCount =
|
|
77
|
+
data.description.split('FAQPage').length >= 2 ? data.description.split('FAQPage').length : 0;
|
|
78
|
+
setFaqElementMaxCountInContents(Math.max(...template.map(data => data.faqCount)));
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
else {
|
|
81
|
+
data.faqCount = 0;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
81
84
|
}
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
if (h2List) {
|
|
86
|
+
h2List.forEach(data => {
|
|
87
|
+
if (data.description && template) {
|
|
88
|
+
data.faqCount =
|
|
89
|
+
data.description.split('FAQPage').length >= 2 ? data.description.split('FAQPage').length : 0;
|
|
90
|
+
setFaqElementMaxCountInContents(Math.max(...template.map(data => data.faqCount)));
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
data.faqCount = 0;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}, [template, h2List]);
|
|
98
|
+
return (<div itemScope={handleFaqItemScope()} itemType={handleFaqItemType()} ref={printRef}>
|
|
84
99
|
<div id={'sub_contents'}>
|
|
85
100
|
<div className="relative m-auto mb-[60px] w-[90%] max-w-screen-2xl max-xs:mb-[30px]">
|
|
86
101
|
<div className={'m-auto mt-[100px] flex gap-[120px] lg:mt-[5em] ' +
|
|
@@ -121,7 +136,7 @@ const Blog = ({ data, tel }) => {
|
|
|
121
136
|
{/*h3*/}
|
|
122
137
|
{template
|
|
123
138
|
.filter(t => t.parent === h2Template.idx)
|
|
124
|
-
.map(
|
|
139
|
+
.map(h3Template => {
|
|
125
140
|
const refer_is_use = h3Template.reference_is_use;
|
|
126
141
|
const refer_length = referenceLinkList.length;
|
|
127
142
|
const refer_content_length = referenceLinkList.filter(i => i.tag_idx === h3Template.idx).length;
|
|
@@ -129,7 +144,7 @@ const Blog = ({ data, tel }) => {
|
|
|
129
144
|
const news_length = newsLinkList.length;
|
|
130
145
|
const news_content_length = newsLinkList.filter(i => i.tag_idx === h3Template.idx).length;
|
|
131
146
|
return (<Fragment key={'h3Contents_section_' + h3Template.idx}>
|
|
132
|
-
<H3Contents h3Template={convertFaqItemType(h3Template)} faqCount={h3Template === null || h3Template === void 0 ? void 0 : h3Template.faqCount}/>
|
|
147
|
+
<H3Contents h3Template={convertFaqItemType(h3Template)} key={'h3영역' + h3Template.idx} faqCount={h3Template === null || h3Template === void 0 ? void 0 : h3Template.faqCount}/>
|
|
133
148
|
{(refer_is_use &&
|
|
134
149
|
refer_length > 0 &&
|
|
135
150
|
refer_content_length > 0) ||
|
|
@@ -191,39 +206,44 @@ const Blog = ({ data, tel }) => {
|
|
|
191
206
|
</div>
|
|
192
207
|
</>) : (<></>)}
|
|
193
208
|
{/* 이전글 다음글 */}
|
|
194
|
-
<
|
|
195
|
-
<div className={'flex
|
|
196
|
-
<
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
209
|
+
<section className={'mt-[60px] w-full max-md:mb-[30px]'}>
|
|
210
|
+
<div className={'flex w-full items-center justify-between max-md:flex-col'}>
|
|
211
|
+
{pnData[0].pre_idx ? (<Link href={pnData[0].pre_domain + 'blog/' + pnData[0].pre_idx} target={pnData[0].pre_center_code != process.env.NEXT_PUBLIC_CENTER_CODE
|
|
212
|
+
? '_target'
|
|
213
|
+
: '_self'} className={'mb-6 flex w-full flex-col gap-[8px] md:mb-0 md:w-auto md:flex-row md:gap-[20px] lg:w-auto lg2:gap-[28px]'} aria-label={'이전글 ' + pnData[0].pre_title}>
|
|
214
|
+
<Image src={Arrow} alt={''} width={15} height={15} className={'m-auto hidden md:block'}/>
|
|
215
|
+
<p className={'text-[#285FA7]'}>이전글</p>
|
|
216
|
+
<div>
|
|
217
|
+
<p className={'truncate md:w-[11em] lg:w-[14em] lg2:w-[18em] '}>
|
|
218
|
+
{pnData[0].pre_title}
|
|
202
219
|
</p>
|
|
203
|
-
</
|
|
204
|
-
|
|
205
|
-
</p>)}
|
|
206
|
-
</div>
|
|
220
|
+
</div>
|
|
221
|
+
</Link>) : (<div className={'flex w-[30%] gap-[28px]'}></div>)}
|
|
207
222
|
|
|
208
|
-
|
|
209
|
-
|
|
223
|
+
{pnData[0].next_idx ? (<>
|
|
224
|
+
<Link href={pnData[0].next_domain + 'blog/' + pnData[0].next_idx} target={pnData[0].next_center_code != process.env.NEXT_PUBLIC_CENTER_CODE
|
|
225
|
+
? '_target'
|
|
226
|
+
: '_self'} className={'flex w-full flex-col justify-end gap-[8px] md:order-last md:w-auto md:flex-row md:gap-[20px] lg:w-auto lg2:gap-[28px]'} aria-label={'다음글 ' + pnData[0].next_title}>
|
|
227
|
+
<p className={'text-[#285FA7]'}>다음글</p>
|
|
228
|
+
<div aria-label={'다음글 ' + pnData[0].next_title}>
|
|
229
|
+
<p className={'truncate md:w-[11em] lg:w-[14em] lg2:w-[18em] '}>
|
|
230
|
+
{pnData[0].next_title}
|
|
231
|
+
</p>
|
|
232
|
+
</div>
|
|
233
|
+
<Image src={RightArrow} alt={''} width={15} height={15} className={'m-auto hidden md:block'}/>
|
|
234
|
+
</Link>
|
|
235
|
+
</>) : (<div className={'order-last flex w-[30%] gap-[28px]'}></div>)}
|
|
236
|
+
|
|
237
|
+
<Link href={`/blog`} className={'max-md:mt-[40px]'}>
|
|
238
|
+
<div className={'rounded-[30px] border-[1px] border-solid border-[#b0b0b0] bg-[#41464C] px-[32px] py-[10px] text-[#fff] lg2:px-[70px] lg2:py-[15px] '}>
|
|
210
239
|
목록보기
|
|
211
|
-
</
|
|
240
|
+
</div>
|
|
212
241
|
</Link>
|
|
213
|
-
|
|
214
|
-
<div className={'flex w-full flex-col justify-end gap-[8px] lg:w-auto lg:flex-row lg:items-center lg:gap-[20px] lg2:gap-[28px]'}>
|
|
215
|
-
<p className={'text-[18px] text-[#285FA7]'}>다음글</p>
|
|
216
|
-
{nextPost ? (<Link href={nextPost ? nextPost.pathname + String(nextPost.idx) : '#'}>
|
|
217
|
-
<p className={'w-full truncate text-[16px] xs:text-[18px] lg:w-[14em] lg2:w-[18em] xxl:w-[18em] xxl:text-[20px] 5xl:w-[20em] '}>
|
|
218
|
-
{nextPost.title}
|
|
219
|
-
</p>
|
|
220
|
-
</Link>) : (<p className={'truncate text-[16px] xs:text-[18px] lg:w-[14em] lg2:w-[18em] xxl:w-[18em] xxl:text-[20px] 5xl:w-[20em]'}>
|
|
221
|
-
다음글이 없습니다.
|
|
222
|
-
</p>)}
|
|
223
|
-
<Image src={RightArrow} alt={'화살표'} title={'화살표'} width={15} height={15} className={'m-auto hidden lg:block'}/>
|
|
224
|
-
</div>
|
|
225
242
|
</div>
|
|
226
|
-
|
|
243
|
+
|
|
244
|
+
<div className={'my-10 mt-20 w-[100%]'}></div>
|
|
245
|
+
</section>
|
|
246
|
+
|
|
227
247
|
</div>
|
|
228
248
|
</div>
|
|
229
249
|
</div>
|
|
@@ -33,13 +33,11 @@ const Blog = ({ data, tel }: IBlogPageTypes) => {
|
|
|
33
33
|
shortsLinkList,
|
|
34
34
|
youtubeLinkList,
|
|
35
35
|
initialData,
|
|
36
|
-
|
|
37
|
-
prevPost,
|
|
38
|
-
faqElementMaxCountInContents
|
|
36
|
+
pnData
|
|
39
37
|
} = data;
|
|
40
38
|
const { width } = useBrowser(true);
|
|
41
|
-
const [isFaqActive, setIsFaqActive] = useState<boolean>(false);
|
|
42
39
|
const printRef = useRef<HTMLDivElement>(null);
|
|
40
|
+
const [faqElementMaxCountInContents, setFaqElementMaxCountInContents] = useState<number>(0);
|
|
43
41
|
|
|
44
42
|
const h1Title: string = template
|
|
45
43
|
.map(temp => temp.tag === 'h1' && temp.tag_title)
|
|
@@ -63,24 +61,18 @@ const Blog = ({ data, tel }: IBlogPageTypes) => {
|
|
|
63
61
|
}
|
|
64
62
|
};
|
|
65
63
|
|
|
66
|
-
const handleFaqItemType = (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (isFaqActive && (faqElementMaxCountInContents as number) >= 2) {
|
|
64
|
+
const handleFaqItemType = (): string | undefined => {
|
|
65
|
+
// 작성자 FAQPage가 1개일 때만 루트 FAQPage를 제거한다.
|
|
66
|
+
if (faqElementMaxCountInContents === 1) {
|
|
72
67
|
return undefined;
|
|
73
68
|
}
|
|
74
69
|
|
|
75
70
|
return 'https://schema.org/FAQPage';
|
|
76
71
|
};
|
|
77
72
|
|
|
78
|
-
const handleFaqItemScope = (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (isFaqActive && (faqElementMaxCountInContents as number) >= 2) {
|
|
73
|
+
const handleFaqItemScope = (): true | undefined => {
|
|
74
|
+
// 작성자 FAQPage가 1개일 때만 루트 FAQPage를 제거한다.
|
|
75
|
+
if (faqElementMaxCountInContents === 1) {
|
|
84
76
|
return undefined;
|
|
85
77
|
}
|
|
86
78
|
|
|
@@ -88,39 +80,52 @@ const Blog = ({ data, tel }: IBlogPageTypes) => {
|
|
|
88
80
|
};
|
|
89
81
|
|
|
90
82
|
const convertFaqItemType = (template: ISeoTemplateTypes): ISeoTemplateTypes => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
83
|
+
// 작성자 FAQPage가 2개 이상이면 내부 FAQPage를 지우고 루트 FAQPage 1개만 유지한다.
|
|
84
|
+
if (faqElementMaxCountInContents) {
|
|
85
|
+
if (faqElementMaxCountInContents >= 2) {
|
|
86
|
+
const convertedDescription = template.description
|
|
87
|
+
.replaceAll('<div itemscope="" itemtype="https://schema.org/FAQPage">', '<div>')
|
|
88
|
+
.replaceAll('<div itemscope="" itemtype="https://schema.org/FAQPage">', '<div>');
|
|
97
89
|
|
|
98
|
-
|
|
90
|
+
return {
|
|
91
|
+
...template,
|
|
92
|
+
description: convertedDescription
|
|
93
|
+
};
|
|
94
|
+
}
|
|
99
95
|
}
|
|
100
96
|
|
|
101
|
-
return template;
|
|
97
|
+
return { ...template };
|
|
102
98
|
};
|
|
103
99
|
|
|
100
|
+
// template, h2List 순회
|
|
104
101
|
useEffect(() => {
|
|
105
102
|
if (template) {
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
template.forEach(data => {
|
|
104
|
+
if (data.description) {
|
|
105
|
+
data.faqCount =
|
|
106
|
+
data.description.split('FAQPage').length >= 2 ? data.description.split('FAQPage').length : 0;
|
|
107
|
+
setFaqElementMaxCountInContents(Math.max(...template.map(data => data.faqCount as number)));
|
|
108
|
+
} else {
|
|
109
|
+
data.faqCount = 0;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
108
113
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (data
|
|
112
|
-
|
|
114
|
+
if (h2List) {
|
|
115
|
+
h2List.forEach(data => {
|
|
116
|
+
if (data.description && template) {
|
|
117
|
+
data.faqCount =
|
|
118
|
+
data.description.split('FAQPage').length >= 2 ? data.description.split('FAQPage').length : 0;
|
|
119
|
+
setFaqElementMaxCountInContents(Math.max(...template.map(data => data.faqCount as number)));
|
|
120
|
+
} else {
|
|
121
|
+
data.faqCount = 0;
|
|
113
122
|
}
|
|
114
|
-
}
|
|
123
|
+
});
|
|
115
124
|
}
|
|
116
|
-
}, [template]);
|
|
125
|
+
}, [template, h2List]);
|
|
117
126
|
|
|
118
127
|
return (
|
|
119
|
-
<div
|
|
120
|
-
itemScope={handleFaqItemScope(isFaqActive, faqElementMaxCountInContents as number)}
|
|
121
|
-
itemType={handleFaqItemType(isFaqActive, faqElementMaxCountInContents as number)}
|
|
122
|
-
ref={printRef}
|
|
123
|
-
>
|
|
128
|
+
<div itemScope={handleFaqItemScope()} itemType={handleFaqItemType()} ref={printRef}>
|
|
124
129
|
<div id={'sub_contents'}>
|
|
125
130
|
<div className="relative m-auto mb-[60px] w-[90%] max-w-screen-2xl max-xs:mb-[30px]">
|
|
126
131
|
<div
|
|
@@ -195,7 +200,7 @@ const Blog = ({ data, tel }: IBlogPageTypes) => {
|
|
|
195
200
|
{/*h3*/}
|
|
196
201
|
{template
|
|
197
202
|
.filter(t => t.parent === h2Template.idx)
|
|
198
|
-
.map(
|
|
203
|
+
.map(h3Template => {
|
|
199
204
|
const refer_is_use = h3Template.reference_is_use;
|
|
200
205
|
const refer_length = referenceLinkList.length;
|
|
201
206
|
const refer_content_length = referenceLinkList.filter(
|
|
@@ -212,6 +217,7 @@ const Blog = ({ data, tel }: IBlogPageTypes) => {
|
|
|
212
217
|
<Fragment key={'h3Contents_section_' + h3Template.idx}>
|
|
213
218
|
<H3Contents
|
|
214
219
|
h3Template={convertFaqItemType(h3Template)}
|
|
220
|
+
key={'h3영역' + h3Template.idx}
|
|
215
221
|
faqCount={h3Template?.faqCount}
|
|
216
222
|
/>
|
|
217
223
|
{(refer_is_use &&
|
|
@@ -365,89 +371,86 @@ const Blog = ({ data, tel }: IBlogPageTypes) => {
|
|
|
365
371
|
<></>
|
|
366
372
|
)}
|
|
367
373
|
{/* 이전글 다음글 */}
|
|
368
|
-
<
|
|
369
|
-
<div className={'flex
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
374
|
+
<section className={'mt-[60px] w-full max-md:mb-[30px]'}>
|
|
375
|
+
<div className={'flex w-full items-center justify-between max-md:flex-col'}>
|
|
376
|
+
{pnData[0].pre_idx ? (
|
|
377
|
+
<Link
|
|
378
|
+
href={pnData[0].pre_domain + 'blog/' + pnData[0].pre_idx}
|
|
379
|
+
target={
|
|
380
|
+
pnData[0].pre_center_code != process.env.NEXT_PUBLIC_CENTER_CODE
|
|
381
|
+
? '_target'
|
|
382
|
+
: '_self'
|
|
383
|
+
}
|
|
384
|
+
className={
|
|
385
|
+
'mb-6 flex w-full flex-col gap-[8px] md:mb-0 md:w-auto md:flex-row md:gap-[20px] lg:w-auto lg2:gap-[28px]'
|
|
386
|
+
}
|
|
387
|
+
aria-label={'이전글 ' + pnData[0].pre_title}
|
|
388
|
+
>
|
|
389
|
+
<Image
|
|
390
|
+
src={Arrow}
|
|
391
|
+
alt={''}
|
|
392
|
+
width={15}
|
|
393
|
+
height={15}
|
|
394
|
+
className={'m-auto hidden md:block'}
|
|
395
|
+
/>
|
|
396
|
+
<p className={'text-[#285FA7]'}>이전글</p>
|
|
397
|
+
<div>
|
|
398
|
+
<p className={'truncate md:w-[11em] lg:w-[14em] lg2:w-[18em] '}>
|
|
399
|
+
{pnData[0].pre_title}
|
|
392
400
|
</p>
|
|
393
|
-
</
|
|
394
|
-
|
|
395
|
-
|
|
401
|
+
</div>
|
|
402
|
+
</Link>
|
|
403
|
+
) : (
|
|
404
|
+
<div className={'flex w-[30%] gap-[28px]'}></div>
|
|
405
|
+
)}
|
|
406
|
+
|
|
407
|
+
{pnData[0].next_idx ? (
|
|
408
|
+
<>
|
|
409
|
+
<Link
|
|
410
|
+
href={pnData[0].next_domain + 'blog/' + pnData[0].next_idx}
|
|
411
|
+
target={
|
|
412
|
+
pnData[0].next_center_code != process.env.NEXT_PUBLIC_CENTER_CODE
|
|
413
|
+
? '_target'
|
|
414
|
+
: '_self'
|
|
415
|
+
}
|
|
396
416
|
className={
|
|
397
|
-
'
|
|
417
|
+
'flex w-full flex-col justify-end gap-[8px] md:order-last md:w-auto md:flex-row md:gap-[20px] lg:w-auto lg2:gap-[28px]'
|
|
398
418
|
}
|
|
419
|
+
aria-label={'다음글 ' + pnData[0].next_title}
|
|
399
420
|
>
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
421
|
+
<p className={'text-[#285FA7]'}>다음글</p>
|
|
422
|
+
<div aria-label={'다음글 ' + pnData[0].next_title}>
|
|
423
|
+
<p className={'truncate md:w-[11em] lg:w-[14em] lg2:w-[18em] '}>
|
|
424
|
+
{pnData[0].next_title}
|
|
425
|
+
</p>
|
|
426
|
+
</div>
|
|
427
|
+
<Image
|
|
428
|
+
src={RightArrow}
|
|
429
|
+
alt={''}
|
|
430
|
+
width={15}
|
|
431
|
+
height={15}
|
|
432
|
+
className={'m-auto hidden md:block'}
|
|
433
|
+
/>
|
|
434
|
+
</Link>
|
|
435
|
+
</>
|
|
436
|
+
) : (
|
|
437
|
+
<div className={'order-last flex w-[30%] gap-[28px]'}></div>
|
|
438
|
+
)}
|
|
404
439
|
|
|
405
|
-
<Link href={
|
|
406
|
-
<
|
|
440
|
+
<Link href={`/blog`} className={'max-md:mt-[40px]'}>
|
|
441
|
+
<div
|
|
407
442
|
className={
|
|
408
|
-
'rounded-[30px] border-[1px] border-solid border-[#b0b0b0] bg-[#41464C] px-[
|
|
443
|
+
'rounded-[30px] border-[1px] border-solid border-[#b0b0b0] bg-[#41464C] px-[32px] py-[10px] text-[#fff] lg2:px-[70px] lg2:py-[15px] '
|
|
409
444
|
}
|
|
410
445
|
>
|
|
411
446
|
목록보기
|
|
412
|
-
</
|
|
447
|
+
</div>
|
|
413
448
|
</Link>
|
|
414
|
-
|
|
415
|
-
<div
|
|
416
|
-
className={
|
|
417
|
-
'flex w-full flex-col justify-end gap-[8px] lg:w-auto lg:flex-row lg:items-center lg:gap-[20px] lg2:gap-[28px]'
|
|
418
|
-
}
|
|
419
|
-
>
|
|
420
|
-
<p className={'text-[18px] text-[#285FA7]'}>다음글</p>
|
|
421
|
-
{nextPost ? (
|
|
422
|
-
<Link href={nextPost ? nextPost.pathname + String(nextPost.idx) : '#'}>
|
|
423
|
-
<p
|
|
424
|
-
className={
|
|
425
|
-
'w-full truncate text-[16px] xs:text-[18px] lg:w-[14em] lg2:w-[18em] xxl:w-[18em] xxl:text-[20px] 5xl:w-[20em] '
|
|
426
|
-
}
|
|
427
|
-
>
|
|
428
|
-
{nextPost.title}
|
|
429
|
-
</p>
|
|
430
|
-
</Link>
|
|
431
|
-
) : (
|
|
432
|
-
<p
|
|
433
|
-
className={
|
|
434
|
-
'truncate text-[16px] xs:text-[18px] lg:w-[14em] lg2:w-[18em] xxl:w-[18em] xxl:text-[20px] 5xl:w-[20em]'
|
|
435
|
-
}
|
|
436
|
-
>
|
|
437
|
-
다음글이 없습니다.
|
|
438
|
-
</p>
|
|
439
|
-
)}
|
|
440
|
-
<Image
|
|
441
|
-
src={RightArrow}
|
|
442
|
-
alt={'화살표'}
|
|
443
|
-
title={'화살표'}
|
|
444
|
-
width={15}
|
|
445
|
-
height={15}
|
|
446
|
-
className={'m-auto hidden lg:block'}
|
|
447
|
-
/>
|
|
448
|
-
</div>
|
|
449
449
|
</div>
|
|
450
|
-
|
|
450
|
+
|
|
451
|
+
<div className={'my-10 mt-20 w-[100%]'}></div>
|
|
452
|
+
</section>
|
|
453
|
+
|
|
451
454
|
</div>
|
|
452
455
|
</div>
|
|
453
456
|
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IBlogListTypes {
|
|
3
|
+
tag_title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
type_idx: number;
|
|
6
|
+
created_at: string;
|
|
7
|
+
file_alt: string;
|
|
8
|
+
file_path: string;
|
|
9
|
+
save_file_name: string;
|
|
10
|
+
center_code?: string;
|
|
11
|
+
domain?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const BlogList: ({ list, currentPage, totalCount, isCenterBlogHas }: {
|
|
14
|
+
list: IBlogListTypes[];
|
|
15
|
+
currentPage: number;
|
|
16
|
+
totalCount: number;
|
|
17
|
+
isCenterBlogHas: boolean;
|
|
18
|
+
}) => React.JSX.Element;
|
|
19
|
+
export default BlogList;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { useRouter } from 'next/router';
|
|
12
|
+
import React, { useState } from 'react';
|
|
13
|
+
import PageWrapper from '../../Layout/PageWrapper';
|
|
14
|
+
import SearchBar from '../../SearchBar/SearchBar';
|
|
15
|
+
import Link from 'next/link';
|
|
16
|
+
import Image from 'next/image';
|
|
17
|
+
import PaginationForGroup from '../../PaginationForGroup/PaginationForGroup';
|
|
18
|
+
import { htmlTagRemove } from '../../../lib';
|
|
19
|
+
const BlogList = ({ list, currentPage, totalCount, isCenterBlogHas }) => {
|
|
20
|
+
const router = useRouter();
|
|
21
|
+
const [searchInput, setSearchInput] = useState('');
|
|
22
|
+
const handleInputChange = (e) => {
|
|
23
|
+
setSearchInput(e.currentTarget.value);
|
|
24
|
+
};
|
|
25
|
+
const handleClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
yield router.push({
|
|
27
|
+
pathname: '/blog',
|
|
28
|
+
query: { page: 1, search: searchInput }
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
const onPaginationChange = (pageNum) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
yield router.push({
|
|
33
|
+
pathname: '/blog',
|
|
34
|
+
query: Object.assign(Object.assign({}, router.query), { page: pageNum })
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
return (<>
|
|
38
|
+
<PageWrapper>
|
|
39
|
+
<div className="sticky top-[100px] z-[45] mb-[20px] bg-white pb-[2px] pt-4 max-md:top-[60px]">
|
|
40
|
+
<SearchBar onChange={handleInputChange} onClick={handleClick} search={searchInput} placeholder={'검색어를 입력해주세요.'} isKeyPress={true} marginTop={[70, 50, 50]} marginBottom={0}/>
|
|
41
|
+
</div>
|
|
42
|
+
<section className={'column-section'}>
|
|
43
|
+
{(list === null || list === void 0 ? void 0 : list.length) > 0 ? (<div className={'grid gap-[18px] sm:grid-cols-2 lg2:grid-cols-3'}>
|
|
44
|
+
{list.map((card, idx) => (<Link href={card.center_code === process.env.NEXT_PUBLIC_CENTER_CODE || isCenterBlogHas
|
|
45
|
+
? `/blog/${card.type_idx}`
|
|
46
|
+
: card.domain + `blog/${card.type_idx}`} key={idx} className="group flex flex-col overflow-hidden rounded-[30px] border border-solid border-transparent transition duration-300 ease-out hover:border-[#DDDDDD] max-xl:border-[#DDDDDD]" target={card.center_code === process.env.NEXT_PUBLIC_CENTER_CODE || isCenterBlogHas
|
|
47
|
+
? '_self'
|
|
48
|
+
: '_blank'}>
|
|
49
|
+
<div className="relative aspect-square w-full overflow-hidden">
|
|
50
|
+
{card.save_file_name ? (<Image src={process.env.NEXT_PUBLIC_S3_URL +
|
|
51
|
+
'/upload/seo/blog/' +
|
|
52
|
+
card.save_file_name} alt={card.file_alt} fill sizes={'600px'} className="object-cover"/>) : (<Image src={`/images/column/column_list_${(idx % 6) + 1}.webp`} alt="" fill sizes={'600px'} className="object-cover"/>)}
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<div className="flex flex-col gap-3 bg-white px-4 py-6">
|
|
56
|
+
<p className="line-clamp-2 text-xl font-extrabold md:text-2xl" dangerouslySetInnerHTML={{ __html: card.tag_title }}/>
|
|
57
|
+
<p className="line-clamp-2 text-[16px] text-[#666] md:text-[18px]" dangerouslySetInnerHTML={{ __html: htmlTagRemove(card.description) }}></p>
|
|
58
|
+
</div>
|
|
59
|
+
</Link>))}
|
|
60
|
+
</div>) : (<></>)}
|
|
61
|
+
{(list === null || list === void 0 ? void 0 : list.length) < 1 ? (<>
|
|
62
|
+
<div className={'h-[300px] text-center text-[20px] leading-[300px] '}>
|
|
63
|
+
검색 결과가 없습니다.
|
|
64
|
+
</div>
|
|
65
|
+
</>) : (<></>)}
|
|
66
|
+
</section>
|
|
67
|
+
|
|
68
|
+
<PaginationForGroup total={totalCount} currentPage={Number(currentPage)} size={12} className={'my-[100px]'} onChange={onPaginationChange}/>
|
|
69
|
+
</PageWrapper>
|
|
70
|
+
</>);
|
|
71
|
+
};
|
|
72
|
+
export default BlogList;
|