@daeryun/dr_components 0.8.8 → 0.8.10

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,350 @@
1
+ 'use client';
2
+
3
+ import ContentList from './components/ContentList';
4
+ import { useEffect, useRef, useState } from 'react';
5
+ import useBrowser from '../../hook/useBrowser';
6
+ import { ILawyerTypes, ISuccessTypes, ILegalDocumentImageObjectTypes, ISuccessNewPageTypes } from './SuccessNewType';
7
+ import { htmlUrlDecode } from '../../../lib';
8
+ import H2Contents from './components/H2Contents';
9
+ import H3Contents from './components/H3Contents';
10
+ import SeoAdditionalLink from './components/SeoAdditionalLink';
11
+ import PdfPrintCopyLink from '../../PdfPrintCopyLink/PdfPrintCopyLink';
12
+ import SeoYoutube from '../../Seo/SeoYoutube';
13
+ import Image from 'next/image';
14
+ import SeoStrength from '../../Seo/SeoStrength';
15
+ import SeoConsulting from '../../Seo/SeoConsulting';
16
+ import { Lawyer } from '../../Seo/Lawyer';
17
+ import LawInfoContentList from './components/LawInfoContentList';
18
+ import Link from 'next/link';
19
+ import Arrow from '../../../asset/images/success_new/left.webp';
20
+ import RightArrow from '../../../asset/images/success_new/right.webp';
21
+ import { SuccessCase } from './components/SuccessCase';
22
+ import { FieldCase } from './components/FieldCase';
23
+ import SuccessWrapper from './components/SuccessWrapper';
24
+
25
+ //next15 센터
26
+ const SuccessNewView = ({ data, tel }: ISuccessNewPageTypes) => {
27
+ const {
28
+ template,
29
+ contentsList,
30
+ h2List,
31
+ imgData,
32
+ lawyerData,
33
+ fieldData,
34
+ successData,
35
+ groupTopTenLawyerList,
36
+ referenceLinkList,
37
+ newsLinkList,
38
+ shortsLinkList,
39
+ youtubeLinkList,
40
+ pn,
41
+ initialData
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
+ const typeIdxNum: number | null = template && (template[0].type_idx as number);
48
+ const successDataFiltered: ISuccessTypes[] = successData.filter(data => Number(data.type_idx) !== typeIdxNum);
49
+
50
+ const legalDocumentImageObject: ILegalDocumentImageObjectTypes | null =
51
+ imgData && imgData.length > 0 ? (imgData[0] as ILegalDocumentImageObjectTypes) : null;
52
+
53
+ const h1Title: string = template
54
+ .map(temp => temp.tag === 'h1' && temp.tag_title)
55
+ .filter(temp => temp !== false)
56
+ .toString();
57
+
58
+ const h1Description: string = template
59
+ .map(temp => temp.tag === 'h1' && temp.description)
60
+ .filter(temp => temp !== false)
61
+ .toString();
62
+
63
+ //이미지 url
64
+ const imagePath: string = process.env.NEXT_PUBLIC_S3_URL + '';
65
+
66
+ const handleScrollToElement = (idx: number) => {
67
+ if (typeof window != 'undefined') {
68
+ const element = document.getElementById(idx.toString());
69
+ if (element) {
70
+ const topOffset = element.getBoundingClientRect().top;
71
+ window.scrollTo({
72
+ top: window.scrollY + topOffset - 130,
73
+ behavior: 'smooth'
74
+ });
75
+ }
76
+ }
77
+ };
78
+
79
+ const handleClickGoImg = () => {
80
+ const imgLocation = document.getElementById('img_wrap')?.offsetTop ?? 0;
81
+ window.scrollTo({ top: imgLocation + (width > 680 ? 300 : 200), behavior: 'smooth' });
82
+ };
83
+
84
+ // 변호사 6명 맞추기
85
+ useEffect(() => {
86
+ const originLawyerLength = lawyerData.length;
87
+ const maxCount = 6; // 최대 변호사 수
88
+ const sliceCount = maxCount - originLawyerLength;
89
+
90
+ if (originLawyerLength < maxCount) {
91
+ // 중복되지 않은 변호사 리스트 생성
92
+ const additionalLawyers = groupTopTenLawyerList
93
+ .filter(topLawyer => !lawyerData.some(lawyer => lawyer.lawyer_name === topLawyer.lawyer_name))
94
+ .slice(0, sliceCount);
95
+
96
+ // 변호사 리스트 업데이트 (중복 방지)
97
+ setRelatedCaseLawyerList([...lawyerData, ...additionalLawyers]);
98
+ } else {
99
+ // 변호사 수가 충분하면 최대 6명만 설정
100
+ setRelatedCaseLawyerList(lawyerData.slice(0, maxCount));
101
+ }
102
+ }, [lawyerData, groupTopTenLawyerList]);
103
+
104
+ useEffect(() => {
105
+ if (template) {
106
+ // 초기화
107
+ setIsFaqActive(false);
108
+
109
+ for (const data of template) {
110
+ // console.log("faq 활성화: ", data['active_faq']);
111
+ if (data['active_faq']) {
112
+ setIsFaqActive(true);
113
+ }
114
+ }
115
+ }
116
+ }, [template]);
117
+
118
+ return (
119
+ <div itemScope={!isFaqActive} itemType={!isFaqActive ? 'https://schema.org/FAQPage' : ''} ref={printRef}>
120
+ <section>
121
+ <SuccessWrapper>
122
+ <div id="sub_contents">
123
+ <PdfPrintCopyLink fileName={h1Title} printRef={printRef} />
124
+ </div>
125
+ </SuccessWrapper>
126
+ </section>
127
+ <SuccessWrapper className="relative m-auto mb-[100px] mt-[7em] font-[SUIT] max-sm:mt-[70px] max-xs:mb-[30px] lg:mt-[5em]">
128
+ <div className="m-auto mt-[3em] flex gap-[120px] max-5xl:gap-[80px] max-xl:flex-col max-xl:gap-0 lg:mt-[5em]">
129
+ <div>
130
+ <div>
131
+ <h1
132
+ className="text-[52.5px] font-[800] tracking-[-2.1px] text-[#285FA7] max-3xl:text-5xl max-md:text-4xl max-xs:text-[28px]"
133
+ key={h1Title}
134
+ >
135
+ {h1Title}
136
+ </h1>
137
+ <div className="mb-[54px] mt-[16px] 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]">
138
+ <div
139
+ id="ck-content"
140
+ dangerouslySetInnerHTML={{
141
+ __html: htmlUrlDecode(
142
+ h1Description.replace('../../UploadFile', '/SE2/upload') as string
143
+ )
144
+ }}
145
+ />
146
+ </div>
147
+ </div>
148
+ <article className="w-full max-w-[1076px] overflow-hidden">
149
+ <ContentList
150
+ template={template}
151
+ h2List={h2List || []}
152
+ onImageMove={handleClickGoImg}
153
+ onScrollToElement={handleScrollToElement}
154
+ />
155
+ {h2List?.map((h2Template, index) => (
156
+ <section
157
+ className="mt-[52px] sm:mt-[62px] lg:mt-[75px]"
158
+ key={'h2영역' + h2Template.idx}
159
+ >
160
+ <H2Contents h2Template={h2Template} index={index} />
161
+ {template
162
+ .filter(t => t.parent === h2Template.idx)
163
+ .map((h3Template, h3Index) => (
164
+ <H3Contents h3Template={h3Template} key={'h3영역' + h3Template.idx} />
165
+ ))}
166
+ <span className="flex flex-col gap-[26px] max-2sm:gap-[16px]">
167
+ {h2Template.reference_is_use && referenceLinkList.length > 0 && (
168
+ <SeoAdditionalLink
169
+ type="참고"
170
+ linkList={referenceLinkList.filter(i => i.tag_idx === h2Template.idx)}
171
+ />
172
+ )}
173
+ {h2Template.news_is_use && newsLinkList.length > 0 && (
174
+ <SeoAdditionalLink
175
+ type="관련기사"
176
+ linkList={newsLinkList.filter(i => i.tag_idx === h2Template.idx)}
177
+ />
178
+ )}
179
+ {h2Template.youtube_is_use && (
180
+ <>
181
+ {shortsLinkList.length > 0 && (
182
+ <SeoYoutube
183
+ type={'shorts'}
184
+ linkList={shortsLinkList.filter(
185
+ i => i.tag_idx === h2Template.idx
186
+ )}
187
+ />
188
+ )}
189
+ {youtubeLinkList.length > 0 && (
190
+ <SeoYoutube
191
+ type={'youtube'}
192
+ linkList={youtubeLinkList.filter(
193
+ i => i.tag_idx === h2Template.idx
194
+ )}
195
+ />
196
+ )}
197
+ </>
198
+ )}
199
+ </span>
200
+ </section>
201
+ ))}
202
+ {imgData && imgData.length > 0 && (
203
+ <section
204
+ id="img_wrap"
205
+ className={`relative mt-[100px] flex min-h-[400px] items-center justify-start gap-[100px] px-[30px] 2xs:mb-[60px] xl:mb-[200px]`}
206
+ >
207
+ <div className="h-fit w-[400px] border-[30px] border-solid border-[#e9e9e9] bg-[#e9e9e9] max-xl:w-[350px] max-xl:border-[25px] max-sm:w-full max-sm:max-w-[350px]">
208
+ <Image
209
+ src={imagePath + legalDocumentImageObject?.img_url}
210
+ alt={legalDocumentImageObject?.alt ?? ''}
211
+ width={382}
212
+ height={510}
213
+ className={'h-auto w-full'}
214
+ quality={100}
215
+ draggable={false}
216
+ />
217
+ </div>
218
+ </section>
219
+ )}
220
+ </article>
221
+ {width >= 1280 ? (
222
+ <div className="flex flex-col gap-[60px] lg:mt-[60px]">
223
+ <div className="relative w-full">
224
+ <SeoStrength initialData={initialData} />
225
+ </div>
226
+ <SeoConsulting tel={'1800-7905'} />
227
+ <LawInfoContentList contentsList={contentsList} template={template} className="" />
228
+ </div>
229
+ ) : null}
230
+ </div>
231
+ {(fieldData.length > 0 || relatedCaseLawyerList.length > 0 || successDataFiltered.length > 0) && (
232
+ <span className="relative mb-[30px] mt-[170px] w-[340px] shrink-0 max-3xl:mt-[150px] max-3xl:w-[300px] max-xl:mt-[50px] max-xl:w-full max-xl:pt-0">
233
+ <span
234
+ id="fixSideBar"
235
+ className="top-[140px] flex w-[340px] flex-col gap-[50px] max-3xl:w-[300px] max-xl:w-full xl:sticky"
236
+ >
237
+ {successDataFiltered.length > 0 && <SuccessCase successData={successDataFiltered} />}
238
+ {fieldData.length > 0 && <FieldCase fieldData={fieldData} />}
239
+ {relatedCaseLawyerList.length > 0 && <Lawyer lawyerData={relatedCaseLawyerList} />}
240
+ </span>
241
+ </span>
242
+ )}
243
+ </div>
244
+ </SuccessWrapper>
245
+
246
+ <SuccessWrapper className="m-auto mt-[7em] max-md2:mt-[0] max-xs:mb-[30px] lg:mt-[5em]">
247
+ {width < 1280
248
+ ? ((
249
+ <div className="m-auto flex flex-col gap-[60px] ">
250
+ <div className="relative w-full">
251
+ <SeoStrength initialData={initialData} />
252
+ </div>
253
+ <SeoConsulting tel={'1800-7905'} />
254
+ <LawInfoContentList contentsList={contentsList} template={template} />
255
+ </div>
256
+ ) as React.ReactNode)
257
+ : ((<></>) as React.ReactNode)}
258
+
259
+ <div className="m-auto mt-[60px] max-md:mb-[30px]">
260
+ <div
261
+ className={
262
+ 'flex flex-col items-start justify-between md:mb-[60px] lg:flex-row lg:items-center '
263
+ }
264
+ >
265
+ <div
266
+ className={
267
+ '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]'
268
+ }
269
+ >
270
+ <Image
271
+ src={Arrow}
272
+ alt={'화살표'}
273
+ title={'화살표'}
274
+ width={15}
275
+ height={15}
276
+ className={'m-auto hidden lg:block'}
277
+ />
278
+ <p className={'shrink-0 text-[18px] text-[#285FA7] '}>이전글</p>
279
+ {pn.prev ? (
280
+ <Link href={`${pn.prev.pathname}${pn.prev.id}`}>
281
+ <p
282
+ className={
283
+ 'w-full truncate text-[16px] xs:text-[18px] lg:w-[14em] lg2:w-[18em] xxl:w-[18em] xxl:text-[20px] 5xl:w-[20em] '
284
+ }
285
+ >
286
+ {pn.prev.title}
287
+ </p>
288
+ </Link>
289
+ ) : (
290
+ <p
291
+ className={
292
+ 'truncate text-[16px] xs:text-[18px] lg:w-[14em] lg2:w-[18em] xxl:w-[18em] xxl:text-[20px] 5xl:w-[20em] '
293
+ }
294
+ >
295
+ 이전글이 없습니다.
296
+ </p>
297
+ )}
298
+ </div>
299
+
300
+ <Link href={`/success`} className={'hidden shrink-0 lg:block'}>
301
+ <button
302
+ className={
303
+ 'rounded-[30px] border-[1px] border-solid border-[#b0b0b0] bg-[#41464C] px-[40px] py-[10px] text-[#fff] xxl:px-[70px] xxl:py-[15px]'
304
+ }
305
+ >
306
+ 목록보기
307
+ </button>
308
+ </Link>
309
+
310
+ <div
311
+ className={
312
+ 'flex w-full flex-col justify-end gap-[8px] lg:w-auto lg:flex-row lg:items-center lg:gap-[20px] lg2:gap-[28px]'
313
+ }
314
+ >
315
+ <p className={'shrink-0 text-[18px] text-[#285FA7]'}>다음글</p>
316
+ {pn.next ? (
317
+ <Link href={`${pn.next.pathname}${pn.next.id}`}>
318
+ <p
319
+ className={
320
+ 'w-full truncate text-[16px] xs:text-[18px] lg:w-[14em] lg2:w-[18em] xxl:w-[18em] xxl:text-[20px] 5xl:w-[20em] '
321
+ }
322
+ >
323
+ {pn.next.title}
324
+ </p>
325
+ </Link>
326
+ ) : (
327
+ <p
328
+ className={
329
+ 'truncate text-[16px] xs:text-[18px] lg:w-[14em] lg2:w-[18em] xxl:w-[18em] xxl:text-[20px] 5xl:w-[20em]'
330
+ }
331
+ >
332
+ 다음글이 없습니다.
333
+ </p>
334
+ )}
335
+ <Image
336
+ src={RightArrow}
337
+ alt={'화살표'}
338
+ title={'화살표'}
339
+ width={15}
340
+ height={15}
341
+ className={'m-auto hidden lg:block'}
342
+ />
343
+ </div>
344
+ </div>
345
+ </div>
346
+ </SuccessWrapper>
347
+ </div>
348
+ );
349
+ };
350
+ export default SuccessNewView;
@@ -0,0 +1,8 @@
1
+ import React, { ReactNode } from 'react';
2
+ interface WrapperProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ children: ReactNode;
4
+ className?: string;
5
+ id?: string;
6
+ }
7
+ declare const SuccessWrapper: React.ForwardRefExoticComponent<WrapperProps & React.RefAttributes<HTMLDivElement>>;
8
+ export default SuccessWrapper;
@@ -0,0 +1,31 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import React, { forwardRef } from 'react';
13
+ const SuccessWrapper = forwardRef((_a, ref) => {
14
+ var { children, className = '', id } = _a, others = __rest(_a, ["children", "className", "id"]);
15
+ return (<div id={id} className={'relative mx-auto w-full max-w-[1920px] ' +
16
+ // PC ( ~ 1500px )
17
+ 'px-[140px] ' +
18
+ // 1500px
19
+ 'max-3xl:px-[80px] ' +
20
+ // 1024px - dev Tablets
21
+ 'max-lg:px-[60px] ' +
22
+ // 900px - design Tablets
23
+ 'max-md2:px-[40px] ' +
24
+ // 520px - dev Mobile ( 320px - design Mobile )
25
+ 'max-2sm:px-[20px] ' +
26
+ className} ref={ref} {...others}>
27
+ {children}
28
+ </div>);
29
+ });
30
+ SuccessWrapper.displayName = 'PageWrapper';
31
+ export default SuccessWrapper;
@@ -0,0 +1,37 @@
1
+ import React, { ReactNode, forwardRef } from 'react';
2
+
3
+ interface WrapperProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ children: ReactNode;
5
+ className?: string; // 스타일 추가
6
+ id?: string;
7
+ }
8
+
9
+ const SuccessWrapper = forwardRef<HTMLDivElement, WrapperProps>(({ children, className = '', id, ...others }, ref) => {
10
+ return (
11
+ <div
12
+ id={id}
13
+ className={
14
+ 'relative mx-auto w-full max-w-[1920px] ' +
15
+ // PC ( ~ 1500px )
16
+ 'px-[140px] ' +
17
+ // 1500px
18
+ 'max-3xl:px-[80px] ' +
19
+ // 1024px - dev Tablets
20
+ 'max-lg:px-[60px] ' +
21
+ // 900px - design Tablets
22
+ 'max-md2:px-[40px] ' +
23
+ // 520px - dev Mobile ( 320px - design Mobile )
24
+ 'max-2sm:px-[20px] ' +
25
+ className
26
+ }
27
+ ref={ref}
28
+ {...others}
29
+ >
30
+ {children}
31
+ </div>
32
+ );
33
+ });
34
+
35
+ SuccessWrapper.displayName = 'PageWrapper';
36
+
37
+ export default SuccessWrapper;
@@ -1911,6 +1911,10 @@ video {
1911
1911
  margin-top: 16px;
1912
1912
  }
1913
1913
 
1914
+ .mt-\[170px\] {
1915
+ margin-top: 170px;
1916
+ }
1917
+
1914
1918
  .mt-\[17px\] {
1915
1919
  margin-top: 17px;
1916
1920
  }
@@ -1983,6 +1987,10 @@ video {
1983
1987
  margin-top: 37px;
1984
1988
  }
1985
1989
 
1990
+ .mt-\[3em\] {
1991
+ margin-top: 3em;
1992
+ }
1993
+
1986
1994
  .mt-\[40px\] {
1987
1995
  margin-top: 40px;
1988
1996
  }
@@ -9136,6 +9144,10 @@ body {
9136
9144
  align-items: center;
9137
9145
  }
9138
9146
 
9147
+ .max-5xl\:gap-\[80px\] {
9148
+ gap: 80px;
9149
+ }
9150
+
9139
9151
  .max-5xl\:gap-y-\[13px\] {
9140
9152
  row-gap: 13px;
9141
9153
  }
@@ -9322,6 +9334,10 @@ body {
9322
9334
  margin-top: 10px;
9323
9335
  }
9324
9336
 
9337
+ .max-3xl\:mt-\[150px\] {
9338
+ margin-top: 150px;
9339
+ }
9340
+
9325
9341
  .max-3xl\:mt-\[16px\] {
9326
9342
  margin-top: 16px;
9327
9343
  }
@@ -13503,6 +13519,10 @@ body {
13503
13519
  margin-top: 68px;
13504
13520
  }
13505
13521
 
13522
+ .max-sm\:mt-\[70px\] {
13523
+ margin-top: 70px;
13524
+ }
13525
+
13506
13526
  .max-sm\:mt-\[80px\] {
13507
13527
  margin-top: 80px;
13508
13528
  }
@@ -17461,6 +17481,10 @@ body {
17461
17481
  margin-bottom: 100px;
17462
17482
  }
17463
17483
 
17484
+ .xl\:mb-\[200px\] {
17485
+ margin-bottom: 200px;
17486
+ }
17487
+
17464
17488
  .xl\:ml-\[2vw\] {
17465
17489
  margin-left: 2vw;
17466
17490
  }