@daeryun/dr_components 1.3.27 → 1.3.29

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