@daeryun/dr_components 1.1.48 → 1.1.49
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/FieldNew/FieldNewView.jsx +43 -5
- package/dist/components/page/FieldNew/FieldNewView.tsx +65 -7
- package/dist/components/page/LawInfoNew/LawInfoNewView.jsx +31 -5
- package/dist/components/page/LawInfoNew/LawInfoNewView.tsx +51 -7
- package/dist/components/page/MyCase/_component/_pagination/PaginationComponent.jsx +1 -1
- package/dist/components/page/MyCase/_component/_pagination/PaginationComponent.tsx +1 -1
- package/dist/components/page/Notice/NoticeList.jsx +16 -11
- package/dist/components/page/Notice/NoticeList.tsx +19 -11
- package/dist/components/page/SuccessNew/SuccessNew.jsx +1 -1
- package/dist/components/page/SuccessNew/SuccessNew.tsx +1 -1
- package/dist/components/page/SuccessNew/SuccessNewView.jsx +43 -5
- package/dist/components/page/SuccessNew/SuccessNewView.tsx +71 -7
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ import { FieldCase } from '../SuccessNew/components/FieldCase';
|
|
|
17
17
|
import FieldWrapper from './FieldWrapper';
|
|
18
18
|
const FieldNewView = ({ data, tel }) => {
|
|
19
19
|
var _a;
|
|
20
|
-
const { template, contentsList, h2List, lawyerData, fieldData, successData, groupTopTenLawyerList, referenceLinkList, newsLinkList, shortsLinkList, youtubeLinkList, initialData } = data;
|
|
20
|
+
const { template, contentsList, h2List, lawyerData, fieldData, successData, groupTopTenLawyerList, referenceLinkList, newsLinkList, shortsLinkList, youtubeLinkList, initialData, faqElementMaxCountInContents } = data;
|
|
21
21
|
const { width } = useBrowser(true);
|
|
22
22
|
const [relatedCaseLawyerList, setRelatedCaseLawyerList] = useState(lawyerData);
|
|
23
23
|
const [isFaqActive, setIsFaqActive] = useState(false);
|
|
@@ -44,6 +44,32 @@ const FieldNewView = ({ data, tel }) => {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
+
const handleFaqItemType = (isFaqActive, faqElementMaxCountInContents) => {
|
|
48
|
+
if (isFaqActive && faqElementMaxCountInContents === 0) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
if (isFaqActive && faqElementMaxCountInContents >= 2) {
|
|
52
|
+
return 'https://schema.org/FAQPage';
|
|
53
|
+
}
|
|
54
|
+
return 'https://schema.org/FAQPage';
|
|
55
|
+
};
|
|
56
|
+
const handleFaqItemScope = (isFaqActive, faqElementMaxCountInContents) => {
|
|
57
|
+
if (isFaqActive && faqElementMaxCountInContents === 0) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
if (isFaqActive && faqElementMaxCountInContents >= 2) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
};
|
|
65
|
+
const convertFaqItemType = (template) => {
|
|
66
|
+
if (faqElementMaxCountInContents >= 2) {
|
|
67
|
+
// faqElementMaxCountInContents가 두 개 이상일 경우, template 내부에 FAQPage itemtype을 지운다. FAQPage 중복 이슈로 인한 코드임
|
|
68
|
+
template.description = template.description.replaceAll('<div itemscope="" itemtype="https://schema.org/FAQPage">', '<div>');
|
|
69
|
+
return template;
|
|
70
|
+
}
|
|
71
|
+
return template;
|
|
72
|
+
};
|
|
47
73
|
// 변호사 6명 맞추기
|
|
48
74
|
useEffect(() => {
|
|
49
75
|
const originLawyerLength = lawyerData.length;
|
|
@@ -74,7 +100,19 @@ const FieldNewView = ({ data, tel }) => {
|
|
|
74
100
|
}
|
|
75
101
|
}
|
|
76
102
|
}, [template]);
|
|
77
|
-
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (template) {
|
|
105
|
+
// 초기화
|
|
106
|
+
setIsFaqActive(false);
|
|
107
|
+
for (const data of template) {
|
|
108
|
+
// console.log("faq 활성화: ", data['active_faq']);
|
|
109
|
+
if (data['active_faq']) {
|
|
110
|
+
setIsFaqActive(true);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}, [template]);
|
|
115
|
+
return (<div itemScope={handleFaqItemScope(isFaqActive, faqElementMaxCountInContents)} itemType={handleFaqItemType(isFaqActive, faqElementMaxCountInContents)} ref={printRef}>
|
|
78
116
|
<div id={'sub_contents'}>
|
|
79
117
|
<FieldWrapper>
|
|
80
118
|
<PdfPrintCopyLink fileName={((_a = template.find(t => t.tag === 'h1')) === null || _a === void 0 ? void 0 : _a.tag_title) || ''} printRef={printRef}/>
|
|
@@ -105,11 +143,11 @@ const FieldNewView = ({ data, tel }) => {
|
|
|
105
143
|
|
|
106
144
|
{/* h2 */}
|
|
107
145
|
{h2List === null || h2List === void 0 ? void 0 : h2List.map((h2Template, index) => (<section className={'mt-[52px] sm:mt-[62px] lg:mt-[75px]'} key={'h2영역' + h2Template.idx}>
|
|
108
|
-
<H2Contents h2Template={h2Template} index={index}/>
|
|
146
|
+
<H2Contents h2Template={convertFaqItemType(h2Template)} index={index} faqCount={h2Template === null || h2Template === void 0 ? void 0 : h2Template.faqCount}/>
|
|
109
147
|
{/* h3 */}
|
|
110
148
|
{template
|
|
111
149
|
.filter(t => t.parent === h2Template.idx)
|
|
112
|
-
.map(
|
|
150
|
+
.map(h3Template => {
|
|
113
151
|
const refer_is_use = h3Template.reference_is_use;
|
|
114
152
|
const refer_length = referenceLinkList.length;
|
|
115
153
|
const refer_content_length = referenceLinkList.filter(i => i.tag_idx === h3Template.idx).length;
|
|
@@ -117,7 +155,7 @@ const FieldNewView = ({ data, tel }) => {
|
|
|
117
155
|
const news_length = newsLinkList.length;
|
|
118
156
|
const news_content_length = newsLinkList.filter(i => i.tag_idx === h3Template.idx).length;
|
|
119
157
|
return (<>
|
|
120
|
-
<H3Contents h3Template={h3Template} key={'h3영역' + h3Template.idx}/>
|
|
158
|
+
<H3Contents h3Template={convertFaqItemType(h3Template)} key={'h3영역' + h3Template.idx} faqCount={h3Template === null || h3Template === void 0 ? void 0 : h3Template.faqCount}/>
|
|
121
159
|
{(refer_is_use &&
|
|
122
160
|
refer_length > 0 &&
|
|
123
161
|
refer_content_length > 0) ||
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import ContentList from '../SuccessNew/components/ContentList';
|
|
3
3
|
import { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import useBrowser from '../../hook/useBrowser';
|
|
5
|
-
import { IFieldTypes, ILawyerTypes } from '../SuccessNew/SuccessNewType';
|
|
5
|
+
import { IFieldTypes, ILawyerTypes, ISeoTemplateTypes } from '../SuccessNew/SuccessNewType';
|
|
6
6
|
import { htmlUrlDecode } from '../../../lib';
|
|
7
7
|
import H2Contents from '../SuccessNew/components/H2Contents';
|
|
8
8
|
import H3Contents from '../SuccessNew/components/H3Contents';
|
|
@@ -31,7 +31,8 @@ const FieldNewView = ({ data, tel }: IFieldNewPageTypes) => {
|
|
|
31
31
|
newsLinkList,
|
|
32
32
|
shortsLinkList,
|
|
33
33
|
youtubeLinkList,
|
|
34
|
-
initialData
|
|
34
|
+
initialData,
|
|
35
|
+
faqElementMaxCountInContents
|
|
35
36
|
} = data;
|
|
36
37
|
const { width } = useBrowser(true);
|
|
37
38
|
const [relatedCaseLawyerList, setRelatedCaseLawyerList] = useState<ILawyerTypes[]>(lawyerData);
|
|
@@ -61,6 +62,44 @@ const FieldNewView = ({ data, tel }: IFieldNewPageTypes) => {
|
|
|
61
62
|
}
|
|
62
63
|
};
|
|
63
64
|
|
|
65
|
+
const handleFaqItemType = (isFaqActive: boolean, faqElementMaxCountInContents?: number): string | undefined => {
|
|
66
|
+
if (isFaqActive && faqElementMaxCountInContents === 0) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (isFaqActive && (faqElementMaxCountInContents as number) >= 2) {
|
|
71
|
+
return 'https://schema.org/FAQPage';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return 'https://schema.org/FAQPage';
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const handleFaqItemScope = (isFaqActive: boolean, faqElementMaxCountInContents?: number): true | undefined => {
|
|
78
|
+
if (isFaqActive && faqElementMaxCountInContents === 0) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (isFaqActive && (faqElementMaxCountInContents as number) >= 2) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return true;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const convertFaqItemType = (template: ISeoTemplateTypes): ISeoTemplateTypes => {
|
|
90
|
+
if ((faqElementMaxCountInContents as number) >= 2) {
|
|
91
|
+
// faqElementMaxCountInContents가 두 개 이상일 경우, template 내부에 FAQPage itemtype을 지운다. FAQPage 중복 이슈로 인한 코드임
|
|
92
|
+
template.description = template.description.replaceAll(
|
|
93
|
+
'<div itemscope="" itemtype="https://schema.org/FAQPage">',
|
|
94
|
+
'<div>'
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
return template;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return template;
|
|
101
|
+
};
|
|
102
|
+
|
|
64
103
|
// 변호사 6명 맞추기
|
|
65
104
|
useEffect(() => {
|
|
66
105
|
const originLawyerLength = lawyerData.length;
|
|
@@ -95,10 +134,24 @@ const FieldNewView = ({ data, tel }: IFieldNewPageTypes) => {
|
|
|
95
134
|
}
|
|
96
135
|
}, [template]);
|
|
97
136
|
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (template) {
|
|
139
|
+
// 초기화
|
|
140
|
+
setIsFaqActive(false);
|
|
141
|
+
|
|
142
|
+
for (const data of template) {
|
|
143
|
+
// console.log("faq 활성화: ", data['active_faq']);
|
|
144
|
+
if (data['active_faq']) {
|
|
145
|
+
setIsFaqActive(true);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}, [template]);
|
|
150
|
+
|
|
98
151
|
return (
|
|
99
152
|
<div
|
|
100
|
-
itemScope={isFaqActive
|
|
101
|
-
itemType={isFaqActive
|
|
153
|
+
itemScope={handleFaqItemScope(isFaqActive, faqElementMaxCountInContents as number)}
|
|
154
|
+
itemType={handleFaqItemType(isFaqActive, faqElementMaxCountInContents as number)}
|
|
102
155
|
ref={printRef}
|
|
103
156
|
>
|
|
104
157
|
<div id={'sub_contents'}>
|
|
@@ -159,11 +212,15 @@ const FieldNewView = ({ data, tel }: IFieldNewPageTypes) => {
|
|
|
159
212
|
className={'mt-[52px] sm:mt-[62px] lg:mt-[75px]'}
|
|
160
213
|
key={'h2영역' + h2Template.idx}
|
|
161
214
|
>
|
|
162
|
-
<H2Contents
|
|
215
|
+
<H2Contents
|
|
216
|
+
h2Template={convertFaqItemType(h2Template)}
|
|
217
|
+
index={index}
|
|
218
|
+
faqCount={h2Template?.faqCount}
|
|
219
|
+
/>
|
|
163
220
|
{/* h3 */}
|
|
164
221
|
{template
|
|
165
222
|
.filter(t => t.parent === h2Template.idx)
|
|
166
|
-
.map(
|
|
223
|
+
.map(h3Template => {
|
|
167
224
|
const refer_is_use = h3Template.reference_is_use;
|
|
168
225
|
const refer_length = referenceLinkList.length;
|
|
169
226
|
const refer_content_length = referenceLinkList.filter(
|
|
@@ -179,8 +236,9 @@ const FieldNewView = ({ data, tel }: IFieldNewPageTypes) => {
|
|
|
179
236
|
return (
|
|
180
237
|
<>
|
|
181
238
|
<H3Contents
|
|
182
|
-
h3Template={h3Template}
|
|
239
|
+
h3Template={convertFaqItemType(h3Template)}
|
|
183
240
|
key={'h3영역' + h3Template.idx}
|
|
241
|
+
faqCount={h3Template?.faqCount}
|
|
184
242
|
/>
|
|
185
243
|
{(refer_is_use &&
|
|
186
244
|
refer_length > 0 &&
|
|
@@ -20,7 +20,7 @@ import Arrow from '../../../asset/images/success_new/left.webp';
|
|
|
20
20
|
import RightArrow from '../../../asset/images/success_new/right.webp';
|
|
21
21
|
import LawInfoWrapper from './LawInfoWrapper';
|
|
22
22
|
const LawInfoNewView = ({ data, tel }) => {
|
|
23
|
-
const { template, contentsList, h2List, lawyerData, fieldData, successData, groupTopTenLawyerList, referenceLinkList, newsLinkList, shortsLinkList, youtubeLinkList, initialData, nextPost, prevPost } = data;
|
|
23
|
+
const { template, contentsList, h2List, lawyerData, fieldData, successData, groupTopTenLawyerList, referenceLinkList, newsLinkList, shortsLinkList, youtubeLinkList, initialData, nextPost, prevPost, faqElementMaxCountInContents } = data;
|
|
24
24
|
const { width } = useBrowser(true);
|
|
25
25
|
const [relatedCaseLawyerList, setRelatedCaseLawyerList] = useState(lawyerData);
|
|
26
26
|
const [isFaqActive, setIsFaqActive] = useState(false);
|
|
@@ -45,6 +45,32 @@ const LawInfoNewView = ({ data, tel }) => {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
+
const handleFaqItemType = (isFaqActive, faqElementMaxCountInContents) => {
|
|
49
|
+
if (isFaqActive && faqElementMaxCountInContents === 0) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
if (isFaqActive && faqElementMaxCountInContents >= 2) {
|
|
53
|
+
return 'https://schema.org/FAQPage';
|
|
54
|
+
}
|
|
55
|
+
return 'https://schema.org/FAQPage';
|
|
56
|
+
};
|
|
57
|
+
const handleFaqItemScope = (isFaqActive, faqElementMaxCountInContents) => {
|
|
58
|
+
if (isFaqActive && faqElementMaxCountInContents === 0) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
if (isFaqActive && faqElementMaxCountInContents >= 2) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
};
|
|
66
|
+
const convertFaqItemType = (template) => {
|
|
67
|
+
if (faqElementMaxCountInContents >= 2) {
|
|
68
|
+
// faqElementMaxCountInContents가 두 개 이상일 경우, template 내부에 FAQPage itemtype을 지운다. FAQPage 중복 이슈로 인한 코드임
|
|
69
|
+
template.description = template.description.replaceAll('<div itemscope="" itemtype="https://schema.org/FAQPage">', '<div>');
|
|
70
|
+
return template;
|
|
71
|
+
}
|
|
72
|
+
return template;
|
|
73
|
+
};
|
|
48
74
|
// 변호사 6명 맞추기
|
|
49
75
|
useEffect(() => {
|
|
50
76
|
const originLawyerLength = lawyerData.length;
|
|
@@ -75,7 +101,7 @@ const LawInfoNewView = ({ data, tel }) => {
|
|
|
75
101
|
}
|
|
76
102
|
}
|
|
77
103
|
}, [template]);
|
|
78
|
-
return (<div itemScope={isFaqActive
|
|
104
|
+
return (<div itemScope={handleFaqItemScope(isFaqActive, faqElementMaxCountInContents)} itemType={handleFaqItemType(isFaqActive, faqElementMaxCountInContents)} ref={printRef}>
|
|
79
105
|
<div id={'sub_contents'}>
|
|
80
106
|
<LawInfoWrapper>
|
|
81
107
|
<PdfPrintCopyLink fileName={template.filter(t => t.tag === 'h1')[0].tag_title} printRef={printRef}/>
|
|
@@ -97,10 +123,10 @@ const LawInfoNewView = ({ data, tel }) => {
|
|
|
97
123
|
<ContentList template={template} h2List={h2List ? h2List : []} onScrollToElement={handleScrollToElement}/>
|
|
98
124
|
{h2List &&
|
|
99
125
|
h2List.map((h2Template, index) => (<section className={'mt-[52px] sm:mt-[62px] lg:mt-[75px]'} key={'h2영역' + h2Template.idx}>
|
|
100
|
-
<H2Contents h2Template={h2Template} index={index}/>
|
|
126
|
+
<H2Contents h2Template={convertFaqItemType(h2Template)} index={index} faqCount={h2Template === null || h2Template === void 0 ? void 0 : h2Template.faqCount}/>
|
|
101
127
|
{template
|
|
102
128
|
.filter(t => t.parent === h2Template.idx)
|
|
103
|
-
.map(
|
|
129
|
+
.map(h3Template => {
|
|
104
130
|
const refer_is_use = h3Template.reference_is_use;
|
|
105
131
|
const refer_length = referenceLinkList.length;
|
|
106
132
|
const refer_content_length = referenceLinkList.filter(i => i.tag_idx === h3Template.idx).length;
|
|
@@ -108,7 +134,7 @@ const LawInfoNewView = ({ data, tel }) => {
|
|
|
108
134
|
const news_length = newsLinkList.length;
|
|
109
135
|
const news_content_length = newsLinkList.filter(i => i.tag_idx === h3Template.idx).length;
|
|
110
136
|
return (<>
|
|
111
|
-
<H3Contents h3Template={h3Template} key={'h3영역' + h3Template.idx}/>
|
|
137
|
+
<H3Contents h3Template={convertFaqItemType(h3Template)} key={'h3영역' + h3Template.idx} faqCount={h3Template === null || h3Template === void 0 ? void 0 : h3Template.faqCount}/>
|
|
112
138
|
{(refer_is_use &&
|
|
113
139
|
refer_length > 0 &&
|
|
114
140
|
refer_content_length > 0) ||
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import ContentList from '../SuccessNew/components/ContentList';
|
|
4
4
|
import { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import useBrowser from '../../hook/useBrowser';
|
|
6
|
-
import { ILawyerTypes } from '../SuccessNew/SuccessNewType';
|
|
6
|
+
import { ILawyerTypes, ISeoTemplateTypes } from '../SuccessNew/SuccessNewType';
|
|
7
7
|
import { htmlUrlDecode } from '../../../lib';
|
|
8
8
|
import H2Contents from '../SuccessNew/components/H2Contents';
|
|
9
9
|
import H3Contents from '../SuccessNew/components/H3Contents';
|
|
@@ -39,7 +39,8 @@ const LawInfoNewView = ({ data, tel }: ILawInfoNewPageTypes) => {
|
|
|
39
39
|
youtubeLinkList,
|
|
40
40
|
initialData,
|
|
41
41
|
nextPost,
|
|
42
|
-
prevPost
|
|
42
|
+
prevPost,
|
|
43
|
+
faqElementMaxCountInContents
|
|
43
44
|
} = data;
|
|
44
45
|
const { width } = useBrowser(true);
|
|
45
46
|
const [relatedCaseLawyerList, setRelatedCaseLawyerList] = useState<ILawyerTypes[]>(lawyerData);
|
|
@@ -68,6 +69,44 @@ const LawInfoNewView = ({ data, tel }: ILawInfoNewPageTypes) => {
|
|
|
68
69
|
}
|
|
69
70
|
};
|
|
70
71
|
|
|
72
|
+
const handleFaqItemType = (isFaqActive: boolean, faqElementMaxCountInContents?: number): string | undefined => {
|
|
73
|
+
if (isFaqActive && faqElementMaxCountInContents === 0) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (isFaqActive && (faqElementMaxCountInContents as number) >= 2) {
|
|
78
|
+
return 'https://schema.org/FAQPage';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return 'https://schema.org/FAQPage';
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const handleFaqItemScope = (isFaqActive: boolean, faqElementMaxCountInContents?: number): true | undefined => {
|
|
85
|
+
if (isFaqActive && faqElementMaxCountInContents === 0) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (isFaqActive && (faqElementMaxCountInContents as number) >= 2) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return true;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const convertFaqItemType = (template: ISeoTemplateTypes): ISeoTemplateTypes => {
|
|
97
|
+
if ((faqElementMaxCountInContents as number) >= 2) {
|
|
98
|
+
// faqElementMaxCountInContents가 두 개 이상일 경우, template 내부에 FAQPage itemtype을 지운다. FAQPage 중복 이슈로 인한 코드임
|
|
99
|
+
template.description = template.description.replaceAll(
|
|
100
|
+
'<div itemscope="" itemtype="https://schema.org/FAQPage">',
|
|
101
|
+
'<div>'
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
return template;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return template;
|
|
108
|
+
};
|
|
109
|
+
|
|
71
110
|
// 변호사 6명 맞추기
|
|
72
111
|
useEffect(() => {
|
|
73
112
|
const originLawyerLength = lawyerData.length;
|
|
@@ -104,8 +143,8 @@ const LawInfoNewView = ({ data, tel }: ILawInfoNewPageTypes) => {
|
|
|
104
143
|
|
|
105
144
|
return (
|
|
106
145
|
<div
|
|
107
|
-
itemScope={isFaqActive
|
|
108
|
-
itemType={isFaqActive
|
|
146
|
+
itemScope={handleFaqItemScope(isFaqActive, faqElementMaxCountInContents as number)}
|
|
147
|
+
itemType={handleFaqItemType(isFaqActive, faqElementMaxCountInContents as number)}
|
|
109
148
|
ref={printRef}
|
|
110
149
|
>
|
|
111
150
|
<div id={'sub_contents'}>
|
|
@@ -153,10 +192,14 @@ const LawInfoNewView = ({ data, tel }: ILawInfoNewPageTypes) => {
|
|
|
153
192
|
className={'mt-[52px] sm:mt-[62px] lg:mt-[75px]'}
|
|
154
193
|
key={'h2영역' + h2Template.idx}
|
|
155
194
|
>
|
|
156
|
-
<H2Contents
|
|
195
|
+
<H2Contents
|
|
196
|
+
h2Template={convertFaqItemType(h2Template)}
|
|
197
|
+
index={index}
|
|
198
|
+
faqCount={h2Template?.faqCount}
|
|
199
|
+
/>
|
|
157
200
|
{template
|
|
158
201
|
.filter(t => t.parent === h2Template.idx)
|
|
159
|
-
.map(
|
|
202
|
+
.map(h3Template => {
|
|
160
203
|
const refer_is_use = h3Template.reference_is_use;
|
|
161
204
|
const refer_length = referenceLinkList.length;
|
|
162
205
|
const refer_content_length = referenceLinkList.filter(
|
|
@@ -172,8 +215,9 @@ const LawInfoNewView = ({ data, tel }: ILawInfoNewPageTypes) => {
|
|
|
172
215
|
return (
|
|
173
216
|
<>
|
|
174
217
|
<H3Contents
|
|
175
|
-
h3Template={h3Template}
|
|
218
|
+
h3Template={convertFaqItemType(h3Template)}
|
|
176
219
|
key={'h3영역' + h3Template.idx}
|
|
220
|
+
faqCount={h3Template?.faqCount}
|
|
177
221
|
/>
|
|
178
222
|
{(refer_is_use &&
|
|
179
223
|
refer_length > 0 &&
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Pagination from 'rc-pagination';
|
|
2
2
|
import 'rc-pagination/assets/index.css';
|
|
3
|
-
import localeInfo from '../../_lib/pagination/locale/ko_KR';
|
|
3
|
+
import { default as localeInfo } from '../../_lib/pagination/locale/ko_KR';
|
|
4
4
|
import Image from 'next/image';
|
|
5
5
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
6
6
|
import { usePathname, useSearchParams } from 'next/navigation';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Pagination from 'rc-pagination';
|
|
2
2
|
import 'rc-pagination/assets/index.css';
|
|
3
|
-
import localeInfo from '../../_lib/pagination/locale/ko_KR';
|
|
3
|
+
import { default as localeInfo } from '../../_lib/pagination/locale/ko_KR';
|
|
4
4
|
import Image from 'next/image';
|
|
5
5
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
6
6
|
import { usePathname, useSearchParams } from 'next/navigation';
|
|
@@ -7,7 +7,7 @@ import PaginationComponent from '../../page/MyCase/_component/_pagination/Pagina
|
|
|
7
7
|
import PageTitleBox from '../../PageTitleBox/PageTitleBox';
|
|
8
8
|
import { ImgTypes } from '../../PageTitleBox/ImgTypes';
|
|
9
9
|
import PageWrapper from '../../Layout/PageWrapper';
|
|
10
|
-
const NoticeList = ({ noticeList, noticeName }) => {
|
|
10
|
+
const NoticeList = ({ noticeList = [], noticeName = [] }) => {
|
|
11
11
|
const router = useRouter();
|
|
12
12
|
// 내부 상태 관리
|
|
13
13
|
const [search, setSearch] = useState('');
|
|
@@ -17,8 +17,8 @@ const NoticeList = ({ noticeList, noticeName }) => {
|
|
|
17
17
|
code: ''
|
|
18
18
|
});
|
|
19
19
|
const [currentPage, setCurrentPage] = useState(1);
|
|
20
|
-
const [filteredList, setFilteredList] = useState(noticeList);
|
|
21
|
-
const [total, setTotal] = useState(noticeList.length);
|
|
20
|
+
const [filteredList, setFilteredList] = useState(noticeList || []);
|
|
21
|
+
const [total, setTotal] = useState((noticeList === null || noticeList === void 0 ? void 0 : noticeList.length) || 0);
|
|
22
22
|
const postPerPage = 10;
|
|
23
23
|
const indexOfLastPost = currentPage * postPerPage;
|
|
24
24
|
const indexOfFirstPost = indexOfLastPost - postPerPage;
|
|
@@ -29,13 +29,13 @@ const NoticeList = ({ noticeList, noticeName }) => {
|
|
|
29
29
|
const searchFilter = String(router.query.nameFilter || '');
|
|
30
30
|
let searchResultList = [];
|
|
31
31
|
if (!searchFilter || searchFilter === '전체') {
|
|
32
|
-
searchResultList = noticeList
|
|
32
|
+
searchResultList = (noticeList || []).filter((item) => { var _a, _b; return ((_a = item.title) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTxt)) || ((_b = item.summary) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTxt)); });
|
|
33
33
|
setNameFilter({ code_name: '전체', code: '' });
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
|
-
const filterNameList = noticeList.filter((item) => item.code_name === searchFilter);
|
|
37
|
-
searchResultList = filterNameList
|
|
38
|
-
const code = ((_a = noticeName.find((name) => name.code_name === searchFilter)) === null || _a === void 0 ? void 0 : _a.code) || '';
|
|
36
|
+
const filterNameList = (noticeList || []).filter((item) => item.code_name === searchFilter);
|
|
37
|
+
searchResultList = filterNameList.filter((item) => { var _a, _b; return ((_a = item.title) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTxt)) || ((_b = item.summary) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTxt)); });
|
|
38
|
+
const code = ((_a = (noticeName || []).find((name) => name.code_name === searchFilter)) === null || _a === void 0 ? void 0 : _a.code) || '';
|
|
39
39
|
setNameFilter({ code_name: searchFilter, code });
|
|
40
40
|
}
|
|
41
41
|
setFilteredList(searchResultList);
|
|
@@ -58,11 +58,16 @@ const NoticeList = ({ noticeList, noticeName }) => {
|
|
|
58
58
|
setSearch(searchInput);
|
|
59
59
|
};
|
|
60
60
|
const handlePaginationChange = (pageNum) => {
|
|
61
|
+
const queryParams = { page: pageNum };
|
|
62
|
+
if (search) {
|
|
63
|
+
queryParams.search = search;
|
|
64
|
+
}
|
|
65
|
+
if (nameFilter.code_name && nameFilter.code_name !== '전체') {
|
|
66
|
+
queryParams.nameFilter = nameFilter.code_name;
|
|
67
|
+
}
|
|
61
68
|
router.push({
|
|
62
69
|
pathname: '/notice',
|
|
63
|
-
query:
|
|
64
|
-
? { page: pageNum, search: search, nameFilter: nameFilter.code_name }
|
|
65
|
-
: { page: pageNum, nameFilter: nameFilter.code_name }
|
|
70
|
+
query: queryParams
|
|
66
71
|
});
|
|
67
72
|
};
|
|
68
73
|
const handleCategoryClick = (categoryName) => {
|
|
@@ -91,7 +96,7 @@ const NoticeList = ({ noticeList, noticeName }) => {
|
|
|
91
96
|
}}>
|
|
92
97
|
전체
|
|
93
98
|
</div>
|
|
94
|
-
{noticeName.map((item, index) => (<div tabIndex={0} key={index} className={`${nameFilter.code_name === item.code_name
|
|
99
|
+
{(noticeName || []).map((item, index) => (<div tabIndex={0} key={index} className={`${nameFilter.code_name === item.code_name
|
|
95
100
|
? 'bg-[#285FA7] text-[#fff] '
|
|
96
101
|
: "after:absolute after:right-[-1px] after:z-[-1] after:h-[45%] after:w-[1px] after:bg-[#DBDBDB] after:content-['']"} relative w-[20%] py-3 text-[13px] 2xs:text-[16px] xs:py-4 sm:text-[22px]`} onClick={() => handleCategoryClick(item.code_name)} onKeyDown={(e) => {
|
|
97
102
|
if (e.key === 'Enter') {
|
|
@@ -39,7 +39,7 @@ interface NoticeListProps {
|
|
|
39
39
|
noticeName: NoticeCategory[];
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
const NoticeList = ({ noticeList, noticeName }: NoticeListProps) => {
|
|
42
|
+
const NoticeList = ({ noticeList = [], noticeName = [] }: NoticeListProps) => {
|
|
43
43
|
const router = useRouter();
|
|
44
44
|
|
|
45
45
|
// 내부 상태 관리
|
|
@@ -50,8 +50,8 @@ const NoticeList = ({ noticeList, noticeName }: NoticeListProps) => {
|
|
|
50
50
|
code: ''
|
|
51
51
|
});
|
|
52
52
|
const [currentPage, setCurrentPage] = useState<number>(1);
|
|
53
|
-
const [filteredList, setFilteredList] = useState<INoticeTypes[]>(noticeList);
|
|
54
|
-
const [total, setTotal] = useState<number>(noticeList
|
|
53
|
+
const [filteredList, setFilteredList] = useState<INoticeTypes[]>(noticeList || []);
|
|
54
|
+
const [total, setTotal] = useState<number>(noticeList?.length || 0);
|
|
55
55
|
|
|
56
56
|
const postPerPage = 10;
|
|
57
57
|
const indexOfLastPost = currentPage * postPerPage;
|
|
@@ -65,18 +65,18 @@ const NoticeList = ({ noticeList, noticeName }: NoticeListProps) => {
|
|
|
65
65
|
let searchResultList = [];
|
|
66
66
|
|
|
67
67
|
if (!searchFilter || searchFilter === '전체') {
|
|
68
|
-
searchResultList = noticeList
|
|
68
|
+
searchResultList = (noticeList || []).filter(
|
|
69
69
|
(item: any) =>
|
|
70
70
|
item.title?.toLowerCase().includes(searchTxt) || item.summary?.toLowerCase().includes(searchTxt)
|
|
71
71
|
);
|
|
72
72
|
setNameFilter({ code_name: '전체', code: '' });
|
|
73
73
|
} else {
|
|
74
|
-
const filterNameList = noticeList.filter((item: any) => item.code_name === searchFilter);
|
|
75
|
-
searchResultList = filterNameList
|
|
74
|
+
const filterNameList = (noticeList || []).filter((item: any) => item.code_name === searchFilter);
|
|
75
|
+
searchResultList = filterNameList.filter(
|
|
76
76
|
(item: any) =>
|
|
77
77
|
item.title?.toLowerCase().includes(searchTxt) || item.summary?.toLowerCase().includes(searchTxt)
|
|
78
78
|
);
|
|
79
|
-
const code = noticeName.find((name: any) => name.code_name === searchFilter)?.code || '';
|
|
79
|
+
const code = (noticeName || []).find((name: any) => name.code_name === searchFilter)?.code || '';
|
|
80
80
|
setNameFilter({ code_name: searchFilter, code });
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -103,11 +103,19 @@ const NoticeList = ({ noticeList, noticeName }: NoticeListProps) => {
|
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
const handlePaginationChange = (pageNum: number) => {
|
|
106
|
+
const queryParams: any = { page: pageNum };
|
|
107
|
+
|
|
108
|
+
if (search) {
|
|
109
|
+
queryParams.search = search;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (nameFilter.code_name && nameFilter.code_name !== '전체') {
|
|
113
|
+
queryParams.nameFilter = nameFilter.code_name;
|
|
114
|
+
}
|
|
115
|
+
|
|
106
116
|
router.push({
|
|
107
117
|
pathname: '/notice',
|
|
108
|
-
query:
|
|
109
|
-
? { page: pageNum, search: search, nameFilter: nameFilter.code_name }
|
|
110
|
-
: { page: pageNum, nameFilter: nameFilter.code_name }
|
|
118
|
+
query: queryParams
|
|
111
119
|
});
|
|
112
120
|
};
|
|
113
121
|
|
|
@@ -165,7 +173,7 @@ const NoticeList = ({ noticeList, noticeName }: NoticeListProps) => {
|
|
|
165
173
|
>
|
|
166
174
|
전체
|
|
167
175
|
</div>
|
|
168
|
-
{noticeName.map((item: any, index: number) => (
|
|
176
|
+
{(noticeName || []).map((item: any, index: number) => (
|
|
169
177
|
<div
|
|
170
178
|
tabIndex={0}
|
|
171
179
|
key={index}
|
|
@@ -153,7 +153,7 @@ const SuccessNew = ({ data, tel }) => {
|
|
|
153
153
|
{/*h3*/}
|
|
154
154
|
{template
|
|
155
155
|
.filter(t => t.parent === h2Template.idx)
|
|
156
|
-
.map(
|
|
156
|
+
.map(h3Template => {
|
|
157
157
|
const refer_is_use = h3Template.reference_is_use;
|
|
158
158
|
const refer_length = referenceLinkList.length;
|
|
159
159
|
const refer_content_length = referenceLinkList.filter(i => i.tag_idx === h3Template.idx).length;
|
|
@@ -237,7 +237,7 @@ const SuccessNew = ({ data, tel }: ISuccessNewPageTypes) => {
|
|
|
237
237
|
{/*h3*/}
|
|
238
238
|
{template
|
|
239
239
|
.filter(t => t.parent === h2Template.idx)
|
|
240
|
-
.map(
|
|
240
|
+
.map(h3Template => {
|
|
241
241
|
const refer_is_use = h3Template.reference_is_use;
|
|
242
242
|
const refer_length = referenceLinkList.length;
|
|
243
243
|
const refer_content_length = referenceLinkList.filter(
|
|
@@ -22,7 +22,7 @@ import SuccessWrapper from './components/SuccessWrapper';
|
|
|
22
22
|
//next15 센터
|
|
23
23
|
const SuccessNewView = ({ data, tel }) => {
|
|
24
24
|
var _a;
|
|
25
|
-
const { template, contentsList, h2List, imgData, lawyerData, fieldData, successData, groupTopTenLawyerList, referenceLinkList, newsLinkList, shortsLinkList, youtubeLinkList, pn, initialData } = data;
|
|
25
|
+
const { template, contentsList, h2List, imgData, lawyerData, fieldData, successData, groupTopTenLawyerList, referenceLinkList, newsLinkList, shortsLinkList, youtubeLinkList, pn, initialData, faqElementMaxCountInContents } = data;
|
|
26
26
|
const { width } = useBrowser(true);
|
|
27
27
|
const [relatedCaseLawyerList, setRelatedCaseLawyerList] = useState(lawyerData);
|
|
28
28
|
const [isFaqActive, setIsFaqActive] = useState(false);
|
|
@@ -57,6 +57,32 @@ const SuccessNewView = ({ data, tel }) => {
|
|
|
57
57
|
const imgLocation = (_b = (_a = document.getElementById('img_wrap')) === null || _a === void 0 ? void 0 : _a.offsetTop) !== null && _b !== void 0 ? _b : 0;
|
|
58
58
|
window.scrollTo({ top: imgLocation + (width > 680 ? 300 : 200), behavior: 'smooth' });
|
|
59
59
|
};
|
|
60
|
+
const handleFaqItemType = (isFaqActive, faqElementMaxCountInContents) => {
|
|
61
|
+
if (isFaqActive && faqElementMaxCountInContents === 0) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
if (isFaqActive && faqElementMaxCountInContents >= 2) {
|
|
65
|
+
return 'https://schema.org/FAQPage';
|
|
66
|
+
}
|
|
67
|
+
return 'https://schema.org/FAQPage';
|
|
68
|
+
};
|
|
69
|
+
const handleFaqItemScope = (isFaqActive, faqElementMaxCountInContents) => {
|
|
70
|
+
if (isFaqActive && faqElementMaxCountInContents === 0) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
if (isFaqActive && faqElementMaxCountInContents >= 2) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
};
|
|
78
|
+
const convertFaqItemType = (template) => {
|
|
79
|
+
if (faqElementMaxCountInContents >= 2) {
|
|
80
|
+
// faqElementMaxCountInContents가 두 개 이상일 경우, template 내부에 FAQPage itemtype을 지운다. FAQPage 중복 이슈로 인한 코드임
|
|
81
|
+
template.description = template.description.replaceAll('<div itemscope="" itemtype="https://schema.org/FAQPage">', '<div>');
|
|
82
|
+
return template;
|
|
83
|
+
}
|
|
84
|
+
return template;
|
|
85
|
+
};
|
|
60
86
|
// 변호사 6명 맞추기
|
|
61
87
|
useEffect(() => {
|
|
62
88
|
const originLawyerLength = lawyerData.length;
|
|
@@ -87,7 +113,19 @@ const SuccessNewView = ({ data, tel }) => {
|
|
|
87
113
|
}
|
|
88
114
|
}
|
|
89
115
|
}, [template]);
|
|
90
|
-
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (template) {
|
|
118
|
+
// 초기화
|
|
119
|
+
setIsFaqActive(false);
|
|
120
|
+
for (const data of template) {
|
|
121
|
+
// console.log("faq 활성화: ", data['active_faq']);
|
|
122
|
+
if (data['active_faq']) {
|
|
123
|
+
setIsFaqActive(true);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}, [template]);
|
|
128
|
+
return (<div id="sub_contents" itemScope={handleFaqItemScope(isFaqActive, faqElementMaxCountInContents)} itemType={handleFaqItemType(isFaqActive, faqElementMaxCountInContents)} ref={printRef}>
|
|
91
129
|
<SuccessWrapper>
|
|
92
130
|
<PdfPrintCopyLink fileName={h1Title} printRef={printRef}/>
|
|
93
131
|
</SuccessWrapper>
|
|
@@ -108,10 +146,10 @@ const SuccessNewView = ({ data, tel }) => {
|
|
|
108
146
|
<article className="w-full max-w-[1076px] overflow-hidden">
|
|
109
147
|
<ContentList template={template} h2List={h2List || []} onImageMove={handleClickGoImg} onScrollToElement={handleScrollToElement}/>
|
|
110
148
|
{h2List === null || h2List === void 0 ? void 0 : h2List.map((h2Template, index) => (<section className="mt-[52px] sm:mt-[62px] lg:mt-[75px]" key={'h2영역' + h2Template.idx}>
|
|
111
|
-
<H2Contents h2Template={h2Template} index={index}/>
|
|
149
|
+
<H2Contents h2Template={convertFaqItemType(h2Template)} index={index} faqCount={h2Template === null || h2Template === void 0 ? void 0 : h2Template.faqCount}/>
|
|
112
150
|
{template
|
|
113
151
|
.filter(t => t.parent === h2Template.idx)
|
|
114
|
-
.map(
|
|
152
|
+
.map(h3Template => {
|
|
115
153
|
const refer_is_use = h3Template.reference_is_use;
|
|
116
154
|
const refer_length = referenceLinkList.length;
|
|
117
155
|
const refer_content_length = referenceLinkList.filter(i => i.tag_idx === h3Template.idx).length;
|
|
@@ -119,7 +157,7 @@ const SuccessNewView = ({ data, tel }) => {
|
|
|
119
157
|
const news_length = newsLinkList.length;
|
|
120
158
|
const news_content_length = newsLinkList.filter(i => i.tag_idx === h3Template.idx).length;
|
|
121
159
|
return (<>
|
|
122
|
-
<H3Contents h3Template={h3Template} key={'h3영역' + h3Template.idx}/>
|
|
160
|
+
<H3Contents h3Template={convertFaqItemType(h3Template)} key={'h3영역' + h3Template.idx} faqCount={h3Template === null || h3Template === void 0 ? void 0 : h3Template.faqCount}/>
|
|
123
161
|
{(refer_is_use && refer_length > 0 && refer_content_length > 0) ||
|
|
124
162
|
(news_is_use && news_length > 0 && news_content_length > 0) ? (<span className={'mb-[44px] flex flex-col gap-[26px] px-[10px] sm:mx-[33px] sm:mb-[50px] sm:px-[18px] lg:mb-[78px] ' +
|
|
125
163
|
//520px
|