@daeryun/dr_components 0.8.42 → 0.8.44

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.
@@ -0,0 +1,380 @@
1
+ 'use client';
2
+
3
+ import ContentList from '../SuccessNew/components/ContentList';
4
+ import { useEffect, useRef, useState } from 'react';
5
+ import useBrowser from '../../hook/useBrowser';
6
+ import { ILawyerTypes } from '../SuccessNew/SuccessNewType';
7
+ import { htmlUrlDecode } from '../../../lib';
8
+ import H2Contents from '../SuccessNew/components/H2Contents';
9
+ import H3Contents from '../SuccessNew/components/H3Contents';
10
+ import SeoAdditionalLink from '../SuccessNew/components/SeoAdditionalLink';
11
+ import PdfPrintCopyLink from '../../PdfPrintCopyLink/PdfPrintCopyLink';
12
+ import SeoYoutube from '../../Seo/SeoYoutube';
13
+ import SeoStrength from '../../Seo/SeoStrength';
14
+ import SeoConsulting from '../../Seo/SeoConsulting';
15
+ import { Lawyer } from '../../Seo/Lawyer';
16
+ import LawInfoContentList from '../SuccessNew/components/LawInfoContentList';
17
+ import { SuccessCase } from '../SuccessNew/components/SuccessCase';
18
+ import { FieldCase } from '../SuccessNew/components/FieldCase';
19
+ import { ILawInfoNewPageTypes } from './LawInfoNewTypes';
20
+ import Link from 'next/link';
21
+ import Image from 'next/image';
22
+
23
+ import Arrow from '../../../asset/images/success_new/left.webp';
24
+ import RightArrow from '../../../asset/images/success_new/right.webp';
25
+
26
+ const LawInfoNew = ({ data, tel }: ILawInfoNewPageTypes) => {
27
+ const {
28
+ template,
29
+ contentsList,
30
+ h2List,
31
+ lawyerData,
32
+ fieldData,
33
+ successData,
34
+ groupTopTenLawyerList,
35
+ referenceLinkList,
36
+ newsLinkList,
37
+ shortsLinkList,
38
+ youtubeLinkList,
39
+ initialData,
40
+ nextPost,
41
+ prevPost
42
+ } = data;
43
+ const { width } = useBrowser(true);
44
+ const [relatedCaseLawyerList, setRelatedCaseLawyerList] = useState<ILawyerTypes[]>(lawyerData);
45
+ const [isFaqActive, setIsFaqActive] = useState<boolean>(false);
46
+ const printRef = useRef<HTMLDivElement>(null);
47
+
48
+ const h1Title: string = template
49
+ .map(temp => temp.tag === 'h1' && temp.tag_title)
50
+ .filter(temp => temp !== false)
51
+ .toString();
52
+ const h1Description: string = template
53
+ .map(temp => temp.tag === 'h1' && temp.description)
54
+ .filter(temp => temp !== false)
55
+ .toString();
56
+
57
+ const handleScrollToElement = (idx: number) => {
58
+ if (typeof window != 'undefined') {
59
+ const element = document.getElementById(idx.toString());
60
+ if (element) {
61
+ const topOffset = element.getBoundingClientRect().top;
62
+ window.scrollTo({
63
+ top: window.scrollY + topOffset - 130,
64
+ behavior: 'smooth'
65
+ });
66
+ }
67
+ }
68
+ };
69
+
70
+ // 변호사 6명 맞추기
71
+ useEffect(() => {
72
+ const originLawyerLength = lawyerData.length;
73
+ const maxCount = 6; // 최대 변호사 수
74
+ const sliceCount = maxCount - originLawyerLength;
75
+
76
+ if (originLawyerLength < maxCount) {
77
+ // 중복되지 않은 변호사 리스트 생성
78
+ const additionalLawyers = groupTopTenLawyerList
79
+ .filter(topLawyer => !lawyerData.some(lawyer => lawyer.lawyer_name === topLawyer.lawyer_name))
80
+ .slice(0, sliceCount);
81
+
82
+ // 변호사 리스트 업데이트 (중복 방지)
83
+ setRelatedCaseLawyerList([...lawyerData, ...additionalLawyers]);
84
+ } else {
85
+ // 변호사 수가 충분하면 최대 6명만 설정
86
+ setRelatedCaseLawyerList(lawyerData.slice(0, maxCount));
87
+ }
88
+ }, [lawyerData, groupTopTenLawyerList]);
89
+
90
+ useEffect(() => {
91
+ if (template) {
92
+ // 초기화
93
+ setIsFaqActive(false);
94
+
95
+ for (const data of template) {
96
+ // console.log("faq 활성화: ", data['active_faq']);
97
+ if (data['active_faq']) {
98
+ setIsFaqActive(true);
99
+ }
100
+ }
101
+ }
102
+ }, [template]);
103
+
104
+ return (
105
+ <div
106
+ itemScope={isFaqActive ? undefined : true}
107
+ itemType={isFaqActive ? undefined : 'https://schema.org/FAQPage'}
108
+ ref={printRef}
109
+ >
110
+ <div id={'sub_contents'}>
111
+ <div className="font-[SUIT]] relative m-auto mb-[60px] w-[90%] max-w-screen-2xl max-xs:mb-[30px]">
112
+ <div
113
+ className={
114
+ 'm-auto mt-[100px] flex gap-[120px] lg:mt-[5em] ' +
115
+ //1500px
116
+ 'max-3xl:gap-[80px] ' +
117
+ //1280px
118
+ 'max-xl:mt-0 max-xl:flex-col max-xl:gap-0 ' +
119
+ //600px
120
+ 'max-sm:mt-[10px] '
121
+ }
122
+ >
123
+ <div>
124
+ {template && width < 1280 ? (
125
+ <PdfPrintCopyLink
126
+ fileName={template.filter(t => t.tag === 'h1')[0].tag_title}
127
+ printRef={printRef}
128
+ />
129
+ ) : null}
130
+ <div className={'max-xl:mt-[25px] max-xs:mt-[15px]'}>
131
+ {/* h1 제목 */}
132
+ <h1
133
+ className={
134
+ 'break-keep text-[52.5px] font-[800] tracking-[-2.1px] text-[#285FA7] max-3xl:text-5xl max-md:text-4xl max-xs:text-[28px]'
135
+ }
136
+ >
137
+ {h1Title}
138
+ </h1>
139
+
140
+ {/* h1 설명글 */}
141
+ <div
142
+ className={
143
+ '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]'
144
+ }
145
+ >
146
+ <div
147
+ id={'ck-content'}
148
+ dangerouslySetInnerHTML={{
149
+ __html: htmlUrlDecode(
150
+ h1Description.replace('../../UploadFile', '/SE2/upload') as string
151
+ )
152
+ }}
153
+ />
154
+ </div>
155
+ </div>
156
+
157
+ <article>
158
+ {/*목차*/}
159
+ <ContentList
160
+ template={template}
161
+ h2List={h2List ? h2List : []}
162
+ onScrollToElement={handleScrollToElement}
163
+ />
164
+
165
+ {/*h2*/}
166
+ {h2List &&
167
+ h2List.map((h2Template, index) => {
168
+ return (
169
+ <section
170
+ className={'mt-[52px] sm:mt-[62px] lg:mt-[75px]'}
171
+ key={'h2영역' + h2Template.idx}
172
+ >
173
+ <H2Contents h2Template={h2Template} index={index} />
174
+
175
+ {/*h3*/}
176
+ {template
177
+ .filter(t => t.parent === h2Template.idx)
178
+ .map((h3Template, h3Index) => {
179
+ return (
180
+ <H3Contents
181
+ h3Template={h3Template}
182
+ key={'h3영역' + h3Template.idx}
183
+ />
184
+ );
185
+ })}
186
+ <span
187
+ className={
188
+ 'flex flex-col gap-[26px] ' +
189
+ //520px
190
+ 'max-2sm:gap-[16px]'
191
+ }
192
+ >
193
+ {h2Template.reference_is_use && referenceLinkList.length > 0 && (
194
+ <SeoAdditionalLink
195
+ type={'더보기'}
196
+ linkList={referenceLinkList.filter(
197
+ i => i.tag_idx === h2Template.idx
198
+ )}
199
+ />
200
+ )}
201
+ {h2Template.news_is_use && newsLinkList.length > 0 && (
202
+ <SeoAdditionalLink
203
+ type={'관련기사'}
204
+ linkList={newsLinkList.filter(
205
+ i => i.tag_idx === h2Template.idx
206
+ )}
207
+ />
208
+ )}
209
+ {h2Template.youtube_is_use && (
210
+ <>
211
+ {shortsLinkList.length > 0 && (
212
+ <SeoYoutube
213
+ type={'shorts'}
214
+ linkList={shortsLinkList.filter(
215
+ i => i.tag_idx === h2Template.idx
216
+ )}
217
+ />
218
+ )}
219
+ {youtubeLinkList.length > 0 && (
220
+ <SeoYoutube
221
+ type={'youtube'}
222
+ linkList={youtubeLinkList.filter(
223
+ i => i.tag_idx === h2Template.idx
224
+ )}
225
+ />
226
+ )}
227
+ </>
228
+ )}
229
+ </span>
230
+ </section>
231
+ );
232
+ })}
233
+ </article>
234
+ {width >= 1280 ? (
235
+ <div className={'flex flex-col gap-[60px] lg:mt-[60px]'}>
236
+ <div className={'relative w-full '}>
237
+ <SeoStrength initialData={initialData} />
238
+ </div>
239
+ <SeoConsulting tel={tel} />
240
+ <LawInfoContentList
241
+ contentsList={contentsList}
242
+ template={template}
243
+ className={''}
244
+ />
245
+ </div>
246
+ ) : (
247
+ <></>
248
+ )}
249
+ </div>
250
+
251
+ {(fieldData.length > 0 || relatedCaseLawyerList.length > 0 || successData.length > 0) && (
252
+ <span
253
+ className={
254
+ 'relative mb-[30px] mt-[30px] w-[340px] shrink-0 ' +
255
+ //1500px
256
+ 'max-3xl:mt-[10px] max-3xl:w-[300px] ' +
257
+ //1280px
258
+ 'max-xl:mt-[50px] max-xl:w-full max-xl:pt-0'
259
+ }
260
+ >
261
+ <span
262
+ id={'fixSideBar'}
263
+ className={
264
+ 'top-[140px] flex w-[340px] flex-col gap-[50px] xl:sticky ' +
265
+ 'max-3xl:w-[300px] max-xl:w-full'
266
+ }
267
+ >
268
+ {template && width >= 1280 ? (
269
+ <PdfPrintCopyLink
270
+ fileName={template.filter(t => t.tag === 'h1')[0].tag_title}
271
+ printRef={printRef}
272
+ />
273
+ ) : null}
274
+ {successData.length > 0 && <SuccessCase successData={successData} />}
275
+ {fieldData.length > 0 && <FieldCase fieldData={fieldData} />}
276
+ {relatedCaseLawyerList.length > 0 && <Lawyer lawyerData={relatedCaseLawyerList} />}
277
+ </span>
278
+ </span>
279
+ )}
280
+ </div>
281
+ </div>
282
+ <div className="m-auto mt-[0em] max-w-screen-2xl max-md2:mt-[0] max-xs:mb-[30px] lg:mt-[5em] ">
283
+ <div className="m-auto max-4xl:w-[90%]">
284
+ {width < 1280 ? (
285
+ <>
286
+ <div className="m-auto flex flex-col gap-[60px] max-4xl:w-[90%]">
287
+ <div className={'relative w-full lg:mb-20'}>
288
+ <SeoStrength initialData={initialData} />
289
+ </div>
290
+ <SeoConsulting tel={tel} />
291
+ <LawInfoContentList contentsList={contentsList} template={template} />
292
+ </div>
293
+ </>
294
+ ) : (
295
+ <></>
296
+ )}
297
+ {/* 이전글 다음글 */}
298
+ <div className="m-auto mt-[60px] max-md:mb-[30px]">
299
+ <div className={'flex flex-col items-start justify-between lg:flex-row lg:items-center'}>
300
+ <div
301
+ className={
302
+ '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]'
303
+ }
304
+ >
305
+ <Image
306
+ src={Arrow}
307
+ alt={'화살표'}
308
+ title={'화살표'}
309
+ width={15}
310
+ height={15}
311
+ className={'m-auto hidden lg:block'}
312
+ />
313
+ <p className={'text-[18px] text-[#285FA7]'}>이전글</p>
314
+ {prevPost ? (
315
+ <Link href={prevPost ? prevPost.pathname + String(prevPost.idx) : '#'}>
316
+ <p
317
+ className={
318
+ 'w-full truncate text-[16px] xs:text-[18px] lg:w-[16em] lg2:w-[18em] xxl:w-[20em] xxl:text-[20px] '
319
+ }
320
+ >
321
+ {prevPost.title}
322
+ </p>
323
+ </Link>
324
+ ) : (
325
+ <p className={'truncate md:w-[11em] lg:w-[14em] lg2:w-[18em] '}>
326
+ 이전글이 없습니다.
327
+ </p>
328
+ )}
329
+ </div>
330
+
331
+ <Link href={'/info'} className={'hidden lg:block'}>
332
+ <button
333
+ className={
334
+ 'rounded-[30px] border-[1px] border-solid border-[#b0b0b0] bg-[#41464C] px-[40px] py-[10px] text-[#fff] xxl:px-[70px] xxl:py-[15px]'
335
+ }
336
+ >
337
+ 목록보기
338
+ </button>
339
+ </Link>
340
+
341
+ <div
342
+ className={
343
+ 'flex w-full flex-col justify-end gap-[8px] lg:w-auto lg:flex-row lg:items-center lg:gap-[20px] lg2:gap-[28px]'
344
+ }
345
+ >
346
+ <p className={'text-[18px] text-[#285FA7]'}>다음글</p>
347
+ {nextPost ? (
348
+ <Link href={nextPost ? nextPost.pathname + String(nextPost.idx) : '#'}>
349
+ <p
350
+ className={
351
+ 'w-full truncate text-[16px] xs:text-[18px] lg:w-[16em] lg2:w-[18em] xxl:w-[20em] xxl:text-[20px] '
352
+ }
353
+ >
354
+ {nextPost.title}
355
+ </p>
356
+ </Link>
357
+ ) : (
358
+ <p className={'truncate md:w-[11em] lg:w-[14em] lg2:w-[18em] '}>
359
+ 다음글이 없습니다.
360
+ </p>
361
+ )}
362
+ <Image
363
+ src={RightArrow}
364
+ alt={'화살표'}
365
+ title={'화살표'}
366
+ width={15}
367
+ height={15}
368
+ className={'m-auto hidden lg:block'}
369
+ />
370
+ </div>
371
+ </div>
372
+ </div>
373
+ </div>
374
+ </div>
375
+ </div>
376
+ </div>
377
+ );
378
+ };
379
+
380
+ export default LawInfoNew;
@@ -0,0 +1,30 @@
1
+ import { IInitialDataTypes } from '../../common';
2
+ import { ISeoTemplateTypes, IContentsListTypes, ILawyerTypes, IFieldTypes, IAddLinkTypes, ISuccessTypes } from '../SuccessNew/SuccessNewType';
3
+ export interface ILawInfoNewPageTypes {
4
+ data: ILawInfoNewTypes;
5
+ tel: string;
6
+ }
7
+ export interface ILawInfoNewTypes {
8
+ template: ISeoTemplateTypes[];
9
+ contentsList: IContentsListTypes[] | null;
10
+ h2List: ISeoTemplateTypes[] | null;
11
+ prevPost: {
12
+ idx: number;
13
+ title: string;
14
+ pathname: string;
15
+ };
16
+ nextPost: {
17
+ idx: number;
18
+ title: string;
19
+ pathname: string;
20
+ };
21
+ lawyerData: ILawyerTypes[];
22
+ fieldData: IFieldTypes[];
23
+ successData: ISuccessTypes[];
24
+ groupTopTenLawyerList: ILawyerTypes[];
25
+ referenceLinkList: IAddLinkTypes[];
26
+ newsLinkList: IAddLinkTypes[];
27
+ shortsLinkList: IAddLinkTypes[];
28
+ youtubeLinkList: IAddLinkTypes[];
29
+ initialData: IInitialDataTypes;
30
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ import { IInitialDataTypes } from '../../common';
2
+ import {
3
+ ISeoTemplateTypes,
4
+ IContentsListTypes,
5
+ ILawyerTypes,
6
+ IFieldTypes,
7
+ IAddLinkTypes,
8
+ ISuccessTypes
9
+ } from '../SuccessNew/SuccessNewType';
10
+
11
+ export interface ILawInfoNewPageTypes {
12
+ data: ILawInfoNewTypes;
13
+ tel: string;
14
+ }
15
+ export interface ILawInfoNewTypes {
16
+ template: ISeoTemplateTypes[];
17
+ contentsList: IContentsListTypes[] | null;
18
+ h2List: ISeoTemplateTypes[] | null;
19
+ prevPost: { idx: number; title: string; pathname: string };
20
+ nextPost: { idx: number; title: string; pathname: string };
21
+ lawyerData: ILawyerTypes[];
22
+ fieldData: IFieldTypes[];
23
+ successData: ISuccessTypes[];
24
+ groupTopTenLawyerList: ILawyerTypes[];
25
+ referenceLinkList: IAddLinkTypes[];
26
+ newsLinkList: IAddLinkTypes[];
27
+ shortsLinkList: IAddLinkTypes[];
28
+ youtubeLinkList: IAddLinkTypes[];
29
+ initialData: IInitialDataTypes;
30
+ }