@daeryun/dr_components 1.3.27 → 1.3.28
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/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/common/integrate/index.d.ts +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/index.ts +2 -0
- package/dist/components/page/Blog/Blog.d.ts +3 -0
- package/dist/components/page/Blog/Blog.jsx +232 -0
- package/dist/components/page/Blog/Blog.tsx +454 -0
- package/dist/components/page/Blog/BlogTypes.d.ts +29 -0
- package/dist/components/page/Blog/BlogTypes.js +1 -0
- package/dist/components/page/Blog/BlogTypes.ts +29 -0
- package/dist/components/page/Blog/BlogView.d.ts +3 -0
- package/dist/components/page/Blog/BlogView.jsx +218 -0
- package/dist/components/page/Blog/BlogView.tsx +444 -0
- package/dist/components/page/Blog/BlogWrapper.d.ts +8 -0
- package/dist/components/page/Blog/BlogWrapper.jsx +30 -0
- package/dist/components/page/Blog/BlogWrapper.tsx +36 -0
- package/dist/components/page/index.d.ts +2 -0
- package/dist/components/page/index.js +2 -0
- package/dist/components/page/index.ts +2 -0
- package/dist/styles/globals.css +424 -414
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import ContentList from '../SuccessNew/components/ContentList';
|
|
3
|
+
import { Fragment, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import useBrowser from '../../hook/useBrowser';
|
|
5
|
+
import { htmlUrlDecode } from '../../../lib';
|
|
6
|
+
import H2Contents from '../SuccessNew/components/H2Contents';
|
|
7
|
+
import H3Contents from '../SuccessNew/components/H3Contents';
|
|
8
|
+
import SeoAdditionalLink from '../SuccessNew/components/SeoAdditionalLink';
|
|
9
|
+
import PdfPrintCopyLink from '../../PdfPrintCopyLink/PdfPrintCopyLink';
|
|
10
|
+
import SeoYoutube from '../../Seo/SeoYoutube';
|
|
11
|
+
import SeoStrength from '../../Seo/SeoStrength';
|
|
12
|
+
import SeoConsulting from '../../Seo/SeoConsulting';
|
|
13
|
+
import LawInfoContentList from '../SuccessNew/components/LawInfoContentList';
|
|
14
|
+
import { SuccessCase } from '../SuccessNew/components/SuccessCase';
|
|
15
|
+
import { FieldCase } from '../SuccessNew/components/FieldCase';
|
|
16
|
+
import Link from 'next/link';
|
|
17
|
+
import Image from 'next/image';
|
|
18
|
+
import Arrow from '../../../asset/images/success_new/left.webp';
|
|
19
|
+
import RightArrow from '../../../asset/images/success_new/right.webp';
|
|
20
|
+
import BlogWrapper from './BlogWrapper';
|
|
21
|
+
const BlogView = ({ data, tel }) => {
|
|
22
|
+
const { template, contentsList, h2List, fieldData, successData, referenceLinkList, newsLinkList, shortsLinkList, youtubeLinkList, initialData, nextPost, prevPost, faqElementMaxCountInContents } = data;
|
|
23
|
+
const { width } = useBrowser(true);
|
|
24
|
+
const [isFaqActive, setIsFaqActive] = useState(false);
|
|
25
|
+
const printRef = useRef(null);
|
|
26
|
+
const h1Title = template
|
|
27
|
+
.map(temp => temp.tag === 'h1' && temp.tag_title)
|
|
28
|
+
.filter(temp => temp !== false)
|
|
29
|
+
.toString();
|
|
30
|
+
const h1Description = template
|
|
31
|
+
.map(temp => temp.tag === 'h1' && temp.description)
|
|
32
|
+
.filter(temp => temp !== false)
|
|
33
|
+
.toString();
|
|
34
|
+
const handleScrollToElement = (idx) => {
|
|
35
|
+
if (typeof window != 'undefined') {
|
|
36
|
+
const element = document.getElementById(idx.toString());
|
|
37
|
+
if (element) {
|
|
38
|
+
const topOffset = element.getBoundingClientRect().top;
|
|
39
|
+
window.scrollTo({
|
|
40
|
+
top: window.scrollY + topOffset - 150,
|
|
41
|
+
behavior: 'smooth'
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const handleFaqItemType = (isFaqActive, faqElementMaxCountInContents) => {
|
|
47
|
+
if (isFaqActive && faqElementMaxCountInContents === 0) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
if (isFaqActive && faqElementMaxCountInContents >= 2) {
|
|
51
|
+
return 'https://schema.org/FAQPage';
|
|
52
|
+
}
|
|
53
|
+
return 'https://schema.org/FAQPage';
|
|
54
|
+
};
|
|
55
|
+
const handleFaqItemScope = (isFaqActive, faqElementMaxCountInContents) => {
|
|
56
|
+
if (isFaqActive && faqElementMaxCountInContents === 0) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
if (isFaqActive && faqElementMaxCountInContents >= 2) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
};
|
|
64
|
+
const convertFaqItemType = (template) => {
|
|
65
|
+
if (faqElementMaxCountInContents >= 2) {
|
|
66
|
+
// const before = template.description;
|
|
67
|
+
// faqElementMaxCountInContents가 두 개 이상일 경우, template 내부에 FAQPage itemtype을 지운다. FAQPage 중복 이슈로 인한 코드임
|
|
68
|
+
template.description = template.description.replaceAll('<div itemscope="" itemtype="https://schema.org/FAQPage">', '<div>');
|
|
69
|
+
// 교체가 되었는지 확인
|
|
70
|
+
// console.log('교체 발생:', before !== template.description);
|
|
71
|
+
// console.log('FAQPage 포함 여부:', template.description.includes('FAQPage'));
|
|
72
|
+
return template;
|
|
73
|
+
}
|
|
74
|
+
return template;
|
|
75
|
+
};
|
|
76
|
+
// console.log('isFaqActive:', isFaqActive);
|
|
77
|
+
// console.log('faqElementMaxCountInContents:', faqElementMaxCountInContents);
|
|
78
|
+
// console.log('handleFaqItemType 결과:', handleFaqItemType(isFaqActive, faqElementMaxCountInContents as number));
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (template) {
|
|
81
|
+
// 초기화
|
|
82
|
+
setIsFaqActive(false);
|
|
83
|
+
for (const data of template) {
|
|
84
|
+
// console.log("faq 활성화: ", data['active_faq']);
|
|
85
|
+
if (data['active_faq']) {
|
|
86
|
+
setIsFaqActive(true);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}, [template]);
|
|
91
|
+
return (<div itemScope={handleFaqItemScope(isFaqActive, faqElementMaxCountInContents)} itemType={handleFaqItemType(isFaqActive, faqElementMaxCountInContents)} ref={printRef}>
|
|
92
|
+
<div id={'sub_contents'}>
|
|
93
|
+
<BlogWrapper>
|
|
94
|
+
<PdfPrintCopyLink fileName={template.filter(t => t.tag === 'h1')[0].tag_title} printRef={printRef}/>
|
|
95
|
+
<div className=" relative m-auto mb-[60px] mt-[7em] max-sm:mt-[70px] max-xs:mb-[30px] lg:mt-[5em]">
|
|
96
|
+
<div className="m-auto mt-[3em] flex gap-[120px] max-5xl:gap-[80px] max-xl:flex-col max-xl:gap-0 lg:mt-[5em]">
|
|
97
|
+
<div>
|
|
98
|
+
<div>
|
|
99
|
+
<h1 className={'break-keep text-[52.5px] font-[800] tracking-[-2.1px] text-[#285FA7] max-3xl:text-5xl max-md:text-4xl max-xs:text-[28px]'}>
|
|
100
|
+
{h1Title}
|
|
101
|
+
</h1>
|
|
102
|
+
<div className={'mb-[54px] mt-[16px] whitespace-break-spaces text-[16px] font-normal tracking-[-0.96px] xs:text-[18px] sm:mb-[62px] sm:mt-[26px] sm:text-[20px] lg:mb-[75px] lg:mt-[37.5px] lg:text-[24px]'}>
|
|
103
|
+
<div id={'ck-content'} dangerouslySetInnerHTML={{
|
|
104
|
+
__html: htmlUrlDecode(h1Description.replace('../../UploadFile', '/SE2/upload'))
|
|
105
|
+
}}/>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<article>
|
|
110
|
+
<ContentList template={template} h2List={h2List ? h2List : []} onScrollToElement={handleScrollToElement}/>
|
|
111
|
+
{h2List &&
|
|
112
|
+
h2List.map((h2Template, index) => (<section className={'mt-[52px] sm:mt-[62px] lg:mt-[75px]'} key={'h2영역' + h2Template.idx}>
|
|
113
|
+
<H2Contents h2Template={convertFaqItemType(h2Template)} index={index} faqCount={h2Template === null || h2Template === void 0 ? void 0 : h2Template.faqCount}/>
|
|
114
|
+
{template
|
|
115
|
+
.filter(t => t.parent === h2Template.idx)
|
|
116
|
+
.map(h3Template => {
|
|
117
|
+
const refer_is_use = h3Template.reference_is_use;
|
|
118
|
+
const refer_length = referenceLinkList.length;
|
|
119
|
+
const refer_content_length = referenceLinkList.filter(i => i.tag_idx === h3Template.idx).length;
|
|
120
|
+
const news_is_use = h3Template.news_is_use;
|
|
121
|
+
const news_length = newsLinkList.length;
|
|
122
|
+
const news_content_length = newsLinkList.filter(i => i.tag_idx === h3Template.idx).length;
|
|
123
|
+
return (<Fragment key={'h3Contents_section_' + h3Template.idx}>
|
|
124
|
+
<H3Contents h3Template={convertFaqItemType(h3Template)} faqCount={h3Template === null || h3Template === void 0 ? void 0 : h3Template.faqCount}/>
|
|
125
|
+
{(refer_is_use &&
|
|
126
|
+
refer_length > 0 &&
|
|
127
|
+
refer_content_length > 0) ||
|
|
128
|
+
(news_is_use &&
|
|
129
|
+
news_length > 0 &&
|
|
130
|
+
news_content_length > 0) ? (<span className={'mb-[44px] flex w-full flex-col gap-[26px] px-[10px] sm:mx-[33px] sm:mb-[50px] sm:px-[18px] lg:mb-[78px] ' +
|
|
131
|
+
//520px
|
|
132
|
+
'max-2sm:gap-[16px]'}>
|
|
133
|
+
{refer_is_use && refer_length > 0 && (<SeoAdditionalLink type={'더보기'} linkList={referenceLinkList.filter(i => i.tag_idx === h3Template.idx)}/>)}
|
|
134
|
+
{news_is_use && news_length > 0 && (<SeoAdditionalLink type={'관련기사'} linkList={newsLinkList.filter(i => i.tag_idx === h3Template.idx)}/>)}
|
|
135
|
+
</span>) : (<></>)}
|
|
136
|
+
</Fragment>);
|
|
137
|
+
})}
|
|
138
|
+
<span className={'flex flex-col gap-[26px] max-2sm:gap-[16px]'}>
|
|
139
|
+
{h2Template.reference_is_use && referenceLinkList.length > 0 && (<SeoAdditionalLink type={'더보기'} linkList={referenceLinkList.filter(i => i.tag_idx === h2Template.idx)}/>)}
|
|
140
|
+
{h2Template.news_is_use && newsLinkList.length > 0 && (<SeoAdditionalLink type={'관련기사'} linkList={newsLinkList.filter(i => i.tag_idx === h2Template.idx)}/>)}
|
|
141
|
+
{h2Template.youtube_is_use && (<>
|
|
142
|
+
{shortsLinkList.length > 0 && (<SeoYoutube type={'shorts'} linkList={shortsLinkList.filter(i => i.tag_idx === h2Template.idx)}/>)}
|
|
143
|
+
{youtubeLinkList.length > 0 && (<SeoYoutube type={'youtube'} linkList={youtubeLinkList.filter(i => i.tag_idx === h2Template.idx)}/>)}
|
|
144
|
+
</>)}
|
|
145
|
+
</span>
|
|
146
|
+
</section>))}
|
|
147
|
+
</article>
|
|
148
|
+
{width >= 1280 ? (<div className={'flex flex-col gap-[60px] lg:mt-[60px]'}>
|
|
149
|
+
{contentsList && contentsList.length > 0 ? (<LawInfoContentList contentsList={contentsList} template={template} className={''}/>) : (<></>)}
|
|
150
|
+
|
|
151
|
+
<div className={'relative w-full '}>
|
|
152
|
+
<SeoStrength initialData={initialData}/>
|
|
153
|
+
</div>
|
|
154
|
+
<SeoConsulting tel={tel}/>
|
|
155
|
+
</div>) : (<></>)}
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
{(fieldData.length > 0 || successData.length > 0) && (<span className={'relative mb-[30px] mt-[170px] w-[340px] shrink-0 ' +
|
|
159
|
+
'max-3xl:mt-[150px] max-3xl:w-[300px] ' +
|
|
160
|
+
'max-xl:mt-[50px] max-xl:w-full max-xl:pt-0'}>
|
|
161
|
+
<span id={'fixSideBar'} className={'top-[140px] flex w-[340px] flex-col gap-[50px] xl:sticky ' +
|
|
162
|
+
'max-3xl:w-[300px] max-xl:w-full'}>
|
|
163
|
+
{successData.length > 0 && <SuccessCase successData={successData}/>}
|
|
164
|
+
{fieldData.length > 0 && <FieldCase fieldData={fieldData}/>}
|
|
165
|
+
</span>
|
|
166
|
+
</span>)}
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
</BlogWrapper>
|
|
170
|
+
<BlogWrapper className=" m-auto mt-[7em] max-md2:mt-[0] max-xs:mb-[30px] lg:mt-[5em] ">
|
|
171
|
+
<div className="max-4xl: m-auto">
|
|
172
|
+
{width < 1280 ? (<div className="max-4xl: m-auto flex flex-col gap-[60px]">
|
|
173
|
+
{contentsList && contentsList.length > 0 ? (<LawInfoContentList contentsList={contentsList} template={template} className={''}/>) : (<></>)}
|
|
174
|
+
|
|
175
|
+
<div className={'relative w-full lg:mb-20'}>
|
|
176
|
+
<SeoStrength initialData={initialData}/>
|
|
177
|
+
</div>
|
|
178
|
+
<SeoConsulting tel={tel}/>
|
|
179
|
+
</div>) : (<></>)}
|
|
180
|
+
<div className="m-auto mt-[60px] max-md:mb-[30px]">
|
|
181
|
+
<div className={'flex flex-col items-start justify-between md:mb-[60px] lg:flex-row lg:items-center'}>
|
|
182
|
+
<div className={'mb-6 flex w-full flex-col gap-[8px] lg:mb-0 lg:w-auto lg:flex-row lg:items-center lg:gap-[20px] lg2:gap-[28px]'}>
|
|
183
|
+
<Image src={Arrow} alt={'화살표'} title={'화살표'} width={15} height={15} className={'m-auto hidden lg:block'}/>
|
|
184
|
+
<p className={'shrink-0 text-[18px] text-[#285FA7] '}>이전글</p>
|
|
185
|
+
{prevPost ? (<Link href={prevPost.pathname + String(prevPost.idx)}>
|
|
186
|
+
<p className={'w-full truncate text-[16px] xs:text-[18px] lg:w-[13em] xl:w-[16em] xxl:text-[20px] 4xl:w-[20em] '}>
|
|
187
|
+
{prevPost.title}
|
|
188
|
+
</p>
|
|
189
|
+
</Link>) : (<p className={'truncate text-[16px] lg:w-[13em] xl:w-[16em] xxl:text-[20px] 4xl:w-[20em]'}>
|
|
190
|
+
이전글이 없습니다.
|
|
191
|
+
</p>)}
|
|
192
|
+
</div>
|
|
193
|
+
|
|
194
|
+
<Link href={`/info`} className={'hidden w-[198px] shrink-0 max-xxl:w-[138px] lg:block'}>
|
|
195
|
+
<button className={'rounded-[30px] border-[1px] border-solid border-[#b0b0b0] bg-[#41464C] px-[40px] py-[10px] text-[#fff] xxl:px-[70px] xxl:py-[15px]'}>
|
|
196
|
+
목록보기
|
|
197
|
+
</button>
|
|
198
|
+
</Link>
|
|
199
|
+
|
|
200
|
+
<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]'}>
|
|
201
|
+
<p className={'shrink-0 text-[18px] text-[#285FA7]'}>다음글</p>
|
|
202
|
+
{nextPost ? (<Link href={nextPost.pathname + String(nextPost.idx)}>
|
|
203
|
+
<p className={'w-full truncate text-[16px] xs:text-[18px] lg:w-[13em] xl:w-[16em] xxl:text-[20px] 4xl:w-[20em] '}>
|
|
204
|
+
{nextPost.title}
|
|
205
|
+
</p>
|
|
206
|
+
</Link>) : (<p className={'truncate xs:text-[18px] lg:w-[13em] xl:w-[16em] xxl:text-[20px] 4xl:w-[20em] '}>
|
|
207
|
+
다음글이 없습니다.
|
|
208
|
+
</p>)}
|
|
209
|
+
<Image src={RightArrow} alt={'화살표'} title={'화살표'} width={15} height={15} className={'m-auto hidden lg:block'}/>
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
</BlogWrapper>
|
|
215
|
+
</div>
|
|
216
|
+
</div>);
|
|
217
|
+
};
|
|
218
|
+
export default BlogView;
|