@daeryun/dr_components 1.0.15 → 1.0.17

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.
@@ -15,7 +15,7 @@ import LawInfoContentList from '../SuccessNew/components/LawInfoContentList';
15
15
  import { SuccessCase } from '../SuccessNew/components/SuccessCase';
16
16
  import { FieldCase } from '../SuccessNew/components/FieldCase';
17
17
  const FieldNew = ({ data, tel }) => {
18
- const { template, contentsList, h2List, lawyerData, fieldData, successData, groupTopTenLawyerList, referenceLinkList, newsLinkList, shortsLinkList, youtubeLinkList, initialData } = data;
18
+ const { template, contentsList, h2List, lawyerData, fieldData, successData, groupTopTenLawyerList, referenceLinkList, newsLinkList, shortsLinkList, youtubeLinkList, initialData, faqElementMaxCountInContents } = data;
19
19
  const { width } = useBrowser(true);
20
20
  const [relatedCaseLawyerList, setRelatedCaseLawyerList] = useState(lawyerData);
21
21
  const [isFaqActive, setIsFaqActive] = useState(false);
@@ -42,6 +42,33 @@ const FieldNew = ({ data, tel }) => {
42
42
  }
43
43
  }
44
44
  };
45
+ const handleFaqItemType = (isFaqActive, faqElementMaxCountInContents) => {
46
+ if (isFaqActive && faqElementMaxCountInContents === 0) {
47
+ return undefined;
48
+ }
49
+ if (isFaqActive && faqElementMaxCountInContents >= 2) {
50
+ return 'https://schema.org/FAQPage';
51
+ }
52
+ return 'https://schema.org/FAQPage';
53
+ };
54
+ const handleFaqItemScope = (isFaqActive, faqElementMaxCountInContents) => {
55
+ if (isFaqActive && faqElementMaxCountInContents === 0) {
56
+ return undefined;
57
+ }
58
+ if (isFaqActive && faqElementMaxCountInContents >= 2) {
59
+ return true;
60
+ }
61
+ return true;
62
+ };
63
+ const convertFaqItemType = (template) => {
64
+ console.log('faqElementMaxCountInContents : ', faqElementMaxCountInContents);
65
+ if (faqElementMaxCountInContents >= 2) {
66
+ // 해당 게시글에 faqElementMaxCountInContents가 두 개 이상일 경우, template 내부에 FAQPage itemtype을 지운다. FAQPage 중복 이슈로 인한 코드임
67
+ template.description = template.description.replaceAll('<div itemscope="" itemtype="https://schema.org/FAQPage">', '<div>');
68
+ return template;
69
+ }
70
+ return template;
71
+ };
45
72
  // 변호사 6명 맞추기
46
73
  useEffect(() => {
47
74
  const originLawyerLength = lawyerData.length;
@@ -73,7 +100,7 @@ const FieldNew = ({ data, tel }) => {
73
100
  }
74
101
  }, [template]);
75
102
  return (<>
76
- <div itemScope={isFaqActive ? undefined : true} itemType={isFaqActive ? undefined : 'https://schema.org/FAQPage'} ref={printRef}>
103
+ <div itemScope={handleFaqItemScope(isFaqActive, faqElementMaxCountInContents)} itemType={handleFaqItemType(isFaqActive, faqElementMaxCountInContents)} ref={printRef}>
77
104
  <div id={'sub_contents'} ref={printRef}>
78
105
  <div className="relative m-auto mb-[100px] w-[90%] max-w-screen-2xl font-[SUIT] max-md2:mb-[40px] max-xs:mb-[30px] ">
79
106
  <div className={'m-auto mt-[100px] flex gap-[120px] ' +
@@ -109,7 +136,7 @@ const FieldNew = ({ data, tel }) => {
109
136
  {h2List &&
110
137
  h2List.map((h2Template, index) => {
111
138
  return (<section className={'mt-[52px] sm:mt-[62px] lg:mt-[75px]'} key={'h2영역' + h2Template.idx}>
112
- <H2Contents h2Template={h2Template} index={index}/>
139
+ <H2Contents h2Template={h2Template} index={index} faqCount={h2Template === null || h2Template === void 0 ? void 0 : h2Template.faqCount}/>
113
140
  {/*h3*/}
114
141
  {template
115
142
  .filter(t => t.parent === h2Template.idx)
@@ -121,7 +148,7 @@ const FieldNew = ({ data, tel }) => {
121
148
  const news_length = newsLinkList.length;
122
149
  const news_content_length = newsLinkList.filter(i => i.tag_idx === h3Template.idx).length;
123
150
  return (<>
124
- <H3Contents h3Template={h3Template} key={'h3영역' + h3Template.idx}/>
151
+ <H3Contents h3Template={h3Template} key={'h3영역' + h3Template.idx} faqCount={h3Template === null || h3Template === void 0 ? void 0 : h3Template.faqCount}/>
125
152
  {(refer_is_use &&
126
153
  refer_length > 0 &&
127
154
  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';
@@ -29,7 +29,8 @@ const FieldNew = ({ data, tel }: IFieldNewPageTypes) => {
29
29
  newsLinkList,
30
30
  shortsLinkList,
31
31
  youtubeLinkList,
32
- initialData
32
+ initialData,
33
+ faqElementMaxCountInContents
33
34
  } = data;
34
35
  const { width } = useBrowser(true);
35
36
  const [relatedCaseLawyerList, setRelatedCaseLawyerList] = useState<ILawyerTypes[]>(lawyerData);
@@ -59,6 +60,45 @@ const FieldNew = ({ data, tel }: IFieldNewPageTypes) => {
59
60
  }
60
61
  };
61
62
 
63
+ const handleFaqItemType = (isFaqActive: boolean, faqElementMaxCountInContents?: number): string | undefined => {
64
+ if (isFaqActive && faqElementMaxCountInContents === 0) {
65
+ return undefined;
66
+ }
67
+
68
+ if (isFaqActive && (faqElementMaxCountInContents as number) >= 2) {
69
+ return 'https://schema.org/FAQPage';
70
+ }
71
+
72
+ return 'https://schema.org/FAQPage';
73
+ };
74
+
75
+ const handleFaqItemScope = (isFaqActive: boolean, faqElementMaxCountInContents?: number): true | undefined => {
76
+ if (isFaqActive && faqElementMaxCountInContents === 0) {
77
+ return undefined;
78
+ }
79
+
80
+ if (isFaqActive && (faqElementMaxCountInContents as number) >= 2) {
81
+ return true;
82
+ }
83
+
84
+ return true;
85
+ };
86
+
87
+ const convertFaqItemType = (template: ISeoTemplateTypes): ISeoTemplateTypes => {
88
+ console.log('faqElementMaxCountInContents : ', faqElementMaxCountInContents);
89
+ if ((faqElementMaxCountInContents as number) >= 2) {
90
+ // 해당 게시글에 faqElementMaxCountInContents가 두 개 이상일 경우, template 내부에 FAQPage itemtype을 지운다. FAQPage 중복 이슈로 인한 코드임
91
+ template.description = template.description.replaceAll(
92
+ '&lt;div itemscope="" itemtype="https://schema.org/FAQPage"&gt;',
93
+ '&lt;div&gt;'
94
+ );
95
+
96
+ return template;
97
+ }
98
+
99
+ return template;
100
+ };
101
+
62
102
  // 변호사 6명 맞추기
63
103
  useEffect(() => {
64
104
  const originLawyerLength = lawyerData.length;
@@ -96,8 +136,8 @@ const FieldNew = ({ data, tel }: IFieldNewPageTypes) => {
96
136
  return (
97
137
  <>
98
138
  <div
99
- itemScope={isFaqActive ? undefined : true}
100
- itemType={isFaqActive ? undefined : 'https://schema.org/FAQPage'}
139
+ itemScope={handleFaqItemScope(isFaqActive, faqElementMaxCountInContents as number)}
140
+ itemType={handleFaqItemType(isFaqActive, faqElementMaxCountInContents as number)}
101
141
  ref={printRef}
102
142
  >
103
143
  <div id={'sub_contents'} ref={printRef}>
@@ -165,7 +205,11 @@ const FieldNew = ({ data, tel }: IFieldNewPageTypes) => {
165
205
  className={'mt-[52px] sm:mt-[62px] lg:mt-[75px]'}
166
206
  key={'h2영역' + h2Template.idx}
167
207
  >
168
- <H2Contents h2Template={h2Template} index={index} />
208
+ <H2Contents
209
+ h2Template={h2Template}
210
+ index={index}
211
+ faqCount={h2Template?.faqCount}
212
+ />
169
213
  {/*h3*/}
170
214
  {template
171
215
  .filter(t => t.parent === h2Template.idx)
@@ -187,6 +231,7 @@ const FieldNew = ({ data, tel }: IFieldNewPageTypes) => {
187
231
  <H3Contents
188
232
  h3Template={h3Template}
189
233
  key={'h3영역' + h3Template.idx}
234
+ faqCount={h3Template?.faqCount}
190
235
  />
191
236
  {(refer_is_use &&
192
237
  refer_length > 0 &&
@@ -17,4 +17,5 @@ export interface IFieldNewTypes {
17
17
  shortsLinkList: IAddLinkTypes[];
18
18
  youtubeLinkList: IAddLinkTypes[];
19
19
  initialData: IInitialDataTypes;
20
+ faqElementMaxCountInContents?: number;
20
21
  }
@@ -27,4 +27,5 @@ export interface IFieldNewTypes {
27
27
  shortsLinkList: IAddLinkTypes[];
28
28
  youtubeLinkList: IAddLinkTypes[];
29
29
  initialData: IInitialDataTypes;
30
+ faqElementMaxCountInContents?: number;
30
31
  }
@@ -19,7 +19,7 @@ import Image from 'next/image';
19
19
  import Arrow from '../../../asset/images/success_new/left.webp';
20
20
  import RightArrow from '../../../asset/images/success_new/right.webp';
21
21
  const LawInfoNew = ({ data, tel }) => {
22
- const { template, contentsList, h2List, lawyerData, fieldData, successData, groupTopTenLawyerList, referenceLinkList, newsLinkList, shortsLinkList, youtubeLinkList, initialData, nextPost, prevPost } = data;
22
+ const { template, contentsList, h2List, lawyerData, fieldData, successData, groupTopTenLawyerList, referenceLinkList, newsLinkList, shortsLinkList, youtubeLinkList, initialData, nextPost, prevPost, faqElementMaxCountInContents } = data;
23
23
  const { width } = useBrowser(true);
24
24
  const [relatedCaseLawyerList, setRelatedCaseLawyerList] = useState(lawyerData);
25
25
  const [isFaqActive, setIsFaqActive] = useState(false);
@@ -44,6 +44,33 @@ const LawInfoNew = ({ 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
+ console.log('faqElementMaxCountInContents : ', faqElementMaxCountInContents);
67
+ if (faqElementMaxCountInContents >= 2) {
68
+ // 해당 게시글에 faqElementMaxCountInContents가 두 개 이상일 경우, template 내부에 FAQPage itemtype을 지운다. FAQPage 중복 이슈로 인한 코드임
69
+ template.description = template.description.replaceAll('&lt;div itemscope="" itemtype="https://schema.org/FAQPage"&gt;', '&lt;div&gt;');
70
+ return template;
71
+ }
72
+ return template;
73
+ };
47
74
  // 변호사 6명 맞추기
48
75
  useEffect(() => {
49
76
  const originLawyerLength = lawyerData.length;
@@ -74,9 +101,9 @@ const LawInfoNew = ({ data, tel }) => {
74
101
  }
75
102
  }
76
103
  }, [template]);
77
- return (<div itemScope={isFaqActive ? undefined : true} itemType={isFaqActive ? undefined : 'https://schema.org/FAQPage'} ref={printRef}>
104
+ return (<div itemScope={handleFaqItemScope(isFaqActive, faqElementMaxCountInContents)} itemType={handleFaqItemType(isFaqActive, faqElementMaxCountInContents)} ref={printRef}>
78
105
  <div id={'sub_contents'}>
79
- <div className="font-[SUIT]] relative m-auto mb-[60px] w-[90%] max-w-screen-2xl max-xs:mb-[30px]">
106
+ <div className="relative m-auto mb-[60px] w-[90%] max-w-screen-2xl font-[SUIT] max-xs:mb-[30px]">
80
107
  <div className={'m-auto mt-[100px] flex gap-[120px] lg:mt-[5em] ' +
81
108
  //1700px
82
109
  'max-5xl:gap-[80px] ' +
@@ -109,8 +136,9 @@ const LawInfoNew = ({ data, tel }) => {
109
136
  {/*h2*/}
110
137
  {h2List &&
111
138
  h2List.map((h2Template, index) => {
139
+ console.log('h2Template.faqCount : ', h2Template === null || h2Template === void 0 ? void 0 : h2Template.faqCount);
112
140
  return (<section className={'mt-[52px] sm:mt-[62px] lg:mt-[75px]'} key={'h2영역' + h2Template.idx}>
113
- <H2Contents h2Template={h2Template} index={index}/>
141
+ <H2Contents h2Template={convertFaqItemType(h2Template)} index={index} faqCount={h2Template === null || h2Template === void 0 ? void 0 : h2Template.faqCount}/>
114
142
 
115
143
  {/*h3*/}
116
144
  {template
@@ -123,7 +151,7 @@ const LawInfoNew = ({ data, tel }) => {
123
151
  const news_length = newsLinkList.length;
124
152
  const news_content_length = newsLinkList.filter(i => i.tag_idx === h3Template.idx).length;
125
153
  return (<>
126
- <H3Contents h3Template={h3Template} key={'h3영역' + h3Template.idx}/>
154
+ <H3Contents h3Template={convertFaqItemType(h3Template)} key={'h3영역' + h3Template.idx} faqCount={h3Template === null || h3Template === void 0 ? void 0 : h3Template.faqCount}/>
127
155
  {(refer_is_use &&
128
156
  refer_length > 0 &&
129
157
  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';
@@ -38,7 +38,8 @@ const LawInfoNew = ({ data, tel }: ILawInfoNewPageTypes) => {
38
38
  youtubeLinkList,
39
39
  initialData,
40
40
  nextPost,
41
- prevPost
41
+ prevPost,
42
+ faqElementMaxCountInContents
42
43
  } = data;
43
44
  const { width } = useBrowser(true);
44
45
  const [relatedCaseLawyerList, setRelatedCaseLawyerList] = useState<ILawyerTypes[]>(lawyerData);
@@ -67,6 +68,45 @@ const LawInfoNew = ({ data, tel }: ILawInfoNewPageTypes) => {
67
68
  }
68
69
  };
69
70
 
71
+ const handleFaqItemType = (isFaqActive: boolean, faqElementMaxCountInContents?: number): string | undefined => {
72
+ if (isFaqActive && faqElementMaxCountInContents === 0) {
73
+ return undefined;
74
+ }
75
+
76
+ if (isFaqActive && (faqElementMaxCountInContents as number) >= 2) {
77
+ return 'https://schema.org/FAQPage';
78
+ }
79
+
80
+ return 'https://schema.org/FAQPage';
81
+ };
82
+
83
+ const handleFaqItemScope = (isFaqActive: boolean, faqElementMaxCountInContents?: number): true | undefined => {
84
+ if (isFaqActive && faqElementMaxCountInContents === 0) {
85
+ return undefined;
86
+ }
87
+
88
+ if (isFaqActive && (faqElementMaxCountInContents as number) >= 2) {
89
+ return true;
90
+ }
91
+
92
+ return true;
93
+ };
94
+
95
+ const convertFaqItemType = (template: ISeoTemplateTypes): ISeoTemplateTypes => {
96
+ console.log('faqElementMaxCountInContents : ', faqElementMaxCountInContents);
97
+ if ((faqElementMaxCountInContents as number) >= 2) {
98
+ // 해당 게시글에 faqElementMaxCountInContents가 두 개 이상일 경우, template 내부에 FAQPage itemtype을 지운다. FAQPage 중복 이슈로 인한 코드임
99
+ template.description = template.description.replaceAll(
100
+ '&lt;div itemscope="" itemtype="https://schema.org/FAQPage"&gt;',
101
+ '&lt;div&gt;'
102
+ );
103
+
104
+ return template;
105
+ }
106
+
107
+ return template;
108
+ };
109
+
70
110
  // 변호사 6명 맞추기
71
111
  useEffect(() => {
72
112
  const originLawyerLength = lawyerData.length;
@@ -103,12 +143,12 @@ const LawInfoNew = ({ data, tel }: ILawInfoNewPageTypes) => {
103
143
 
104
144
  return (
105
145
  <div
106
- itemScope={isFaqActive ? undefined : true}
107
- itemType={isFaqActive ? undefined : 'https://schema.org/FAQPage'}
146
+ itemScope={handleFaqItemScope(isFaqActive, faqElementMaxCountInContents as number)}
147
+ itemType={handleFaqItemType(isFaqActive, faqElementMaxCountInContents as number)}
108
148
  ref={printRef}
109
149
  >
110
150
  <div id={'sub_contents'}>
111
- <div className="font-[SUIT]] relative m-auto mb-[60px] w-[90%] max-w-screen-2xl max-xs:mb-[30px]">
151
+ <div className="relative m-auto mb-[60px] w-[90%] max-w-screen-2xl font-[SUIT] max-xs:mb-[30px]">
112
152
  <div
113
153
  className={
114
154
  'm-auto mt-[100px] flex gap-[120px] lg:mt-[5em] ' +
@@ -156,7 +196,14 @@ const LawInfoNew = ({ data, tel }: ILawInfoNewPageTypes) => {
156
196
  </div>
157
197
  </div>
158
198
 
159
- <article>
199
+ <article
200
+ // itemScope={(faqElementMaxCountInContents as number) >= 1 ? undefined : true}
201
+ // itemType={
202
+ // (faqElementMaxCountInContents as number) >= 1
203
+ // ? undefined
204
+ // : 'https://schema.org/FAQPage'
205
+ // }
206
+ >
160
207
  {/*목차*/}
161
208
  <ContentList
162
209
  template={template}
@@ -167,12 +214,17 @@ const LawInfoNew = ({ data, tel }: ILawInfoNewPageTypes) => {
167
214
  {/*h2*/}
168
215
  {h2List &&
169
216
  h2List.map((h2Template, index) => {
217
+ console.log('h2Template.faqCount : ', h2Template?.faqCount);
170
218
  return (
171
219
  <section
172
220
  className={'mt-[52px] sm:mt-[62px] lg:mt-[75px]'}
173
221
  key={'h2영역' + h2Template.idx}
174
222
  >
175
- <H2Contents h2Template={h2Template} index={index} />
223
+ <H2Contents
224
+ h2Template={convertFaqItemType(h2Template)}
225
+ index={index}
226
+ faqCount={h2Template?.faqCount}
227
+ />
176
228
 
177
229
  {/*h3*/}
178
230
  {template
@@ -193,8 +245,9 @@ const LawInfoNew = ({ data, tel }: ILawInfoNewPageTypes) => {
193
245
  return (
194
246
  <>
195
247
  <H3Contents
196
- h3Template={h3Template}
248
+ h3Template={convertFaqItemType(h3Template)}
197
249
  key={'h3영역' + h3Template.idx}
250
+ faqCount={h3Template?.faqCount}
198
251
  />
199
252
  {(refer_is_use &&
200
253
  refer_length > 0 &&
@@ -20,7 +20,7 @@ import { SuccessCase } from './components/SuccessCase';
20
20
  import { FieldCase } from './components/FieldCase';
21
21
  const SuccessNew = ({ data, tel }) => {
22
22
  var _a;
23
- const { template, contentsList, h2List, imgData, lawyerData, fieldData, successData, groupTopTenLawyerList, referenceLinkList, newsLinkList, shortsLinkList, youtubeLinkList, pn, initialData } = data;
23
+ const { template, contentsList, h2List, imgData, lawyerData, fieldData, successData, groupTopTenLawyerList, referenceLinkList, newsLinkList, shortsLinkList, youtubeLinkList, pn, initialData, faqElementMaxCountInContents } = data;
24
24
  const { width } = useBrowser(true);
25
25
  const [relatedCaseLawyerList, setRelatedCaseLawyerList] = useState(lawyerData);
26
26
  const [isFaqActive, setIsFaqActive] = useState(false);
@@ -55,6 +55,33 @@ const SuccessNew = ({ data, tel }) => {
55
55
  const imgLocation = (_b = (_a = document.getElementById('img_wrap')) === null || _a === void 0 ? void 0 : _a.offsetTop) !== null && _b !== void 0 ? _b : 0;
56
56
  window.scrollTo({ top: imgLocation + (width > 680 ? 300 : 200), behavior: 'smooth' });
57
57
  };
58
+ const handleFaqItemType = (isFaqActive, faqElementMaxCountInContents) => {
59
+ if (isFaqActive && faqElementMaxCountInContents === 0) {
60
+ return undefined;
61
+ }
62
+ if (isFaqActive && faqElementMaxCountInContents >= 2) {
63
+ return 'https://schema.org/FAQPage';
64
+ }
65
+ return 'https://schema.org/FAQPage';
66
+ };
67
+ const handleFaqItemScope = (isFaqActive, faqElementMaxCountInContents) => {
68
+ if (isFaqActive && faqElementMaxCountInContents === 0) {
69
+ return undefined;
70
+ }
71
+ if (isFaqActive && faqElementMaxCountInContents >= 2) {
72
+ return true;
73
+ }
74
+ return true;
75
+ };
76
+ const convertFaqItemType = (template) => {
77
+ console.log('faqElementMaxCountInContents : ', faqElementMaxCountInContents);
78
+ if (faqElementMaxCountInContents >= 2) {
79
+ // 해당 게시글에 faqElementMaxCountInContents가 두 개 이상일 경우, template 내부에 FAQPage itemtype을 지운다. FAQPage 중복 이슈로 인한 코드임
80
+ template.description = template.description.replaceAll('&lt;div itemscope="" itemtype="https://schema.org/FAQPage"&gt;', '&lt;div&gt;');
81
+ return template;
82
+ }
83
+ return template;
84
+ };
58
85
  // 변호사 6명 맞추기
59
86
  useEffect(() => {
60
87
  const originLawyerLength = lawyerData.length;
@@ -85,7 +112,7 @@ const SuccessNew = ({ data, tel }) => {
85
112
  }
86
113
  }
87
114
  }, [template]);
88
- return (<div itemScope={isFaqActive ? undefined : true} itemType={isFaqActive ? undefined : 'https://schema.org/FAQPage'} ref={printRef}>
115
+ return (<div itemScope={handleFaqItemScope(isFaqActive, faqElementMaxCountInContents)} itemType={handleFaqItemType(isFaqActive, faqElementMaxCountInContents)} ref={printRef}>
89
116
  <div className="relative m-auto mb-[100px] w-[90%] max-w-screen-2xl font-[SUIT] max-md2:mb-[40px] max-xs:mb-[30px]">
90
117
  <div className={'m-auto mt-[100px] flex gap-[120px] ' +
91
118
  //1700px
@@ -122,7 +149,7 @@ const SuccessNew = ({ data, tel }) => {
122
149
  {h2List &&
123
150
  h2List.map((h2Template, index) => {
124
151
  return (<section className={'mt-[52px] sm:mt-[62px] lg:mt-[75px]'} key={'h2영역' + h2Template.idx}>
125
- <H2Contents h2Template={h2Template} index={index}/>
152
+ <H2Contents h2Template={h2Template} index={index} faqCount={h2Template === null || h2Template === void 0 ? void 0 : h2Template.faqCount}/>
126
153
 
127
154
  {/*h3*/}
128
155
  {template
@@ -135,7 +162,7 @@ const SuccessNew = ({ data, tel }) => {
135
162
  const news_length = newsLinkList.length;
136
163
  const news_content_length = newsLinkList.filter(i => i.tag_idx === h3Template.idx).length;
137
164
  return (<>
138
- <H3Contents h3Template={h3Template} key={'h3영역' + h3Template.idx}/>
165
+ <H3Contents h3Template={h3Template} key={'h3영역' + h3Template.idx} faqCount={h3Template === null || h3Template === void 0 ? void 0 : h3Template.faqCount}/>
139
166
  {(refer_is_use &&
140
167
  refer_length > 0 &&
141
168
  refer_content_length > 0) ||
@@ -3,7 +3,13 @@
3
3
  import ContentList from './components/ContentList';
4
4
  import { useEffect, useRef, useState } from 'react';
5
5
  import useBrowser from '../../hook/useBrowser';
6
- import { ILawyerTypes, ISuccessTypes, ILegalDocumentImageObjectTypes, ISuccessNewPageTypes } from './SuccessNewType';
6
+ import {
7
+ ILawyerTypes,
8
+ ISuccessTypes,
9
+ ILegalDocumentImageObjectTypes,
10
+ ISuccessNewPageTypes,
11
+ ISeoTemplateTypes
12
+ } from './SuccessNewType';
7
13
  import { htmlUrlDecode } from '../../../lib';
8
14
  import H2Contents from './components/H2Contents';
9
15
  import H3Contents from './components/H3Contents';
@@ -35,7 +41,8 @@ const SuccessNew = ({ data, tel }: ISuccessNewPageTypes) => {
35
41
  shortsLinkList,
36
42
  youtubeLinkList,
37
43
  pn,
38
- initialData
44
+ initialData,
45
+ faqElementMaxCountInContents
39
46
  } = data;
40
47
  const { width } = useBrowser(true);
41
48
  const [relatedCaseLawyerList, setRelatedCaseLawyerList] = useState<ILawyerTypes[]>(lawyerData);
@@ -78,6 +85,45 @@ const SuccessNew = ({ data, tel }: ISuccessNewPageTypes) => {
78
85
  window.scrollTo({ top: imgLocation + (width > 680 ? 300 : 200), behavior: 'smooth' });
79
86
  };
80
87
 
88
+ const handleFaqItemType = (isFaqActive: boolean, faqElementMaxCountInContents?: number): string | undefined => {
89
+ if (isFaqActive && faqElementMaxCountInContents === 0) {
90
+ return undefined;
91
+ }
92
+
93
+ if (isFaqActive && (faqElementMaxCountInContents as number) >= 2) {
94
+ return 'https://schema.org/FAQPage';
95
+ }
96
+
97
+ return 'https://schema.org/FAQPage';
98
+ };
99
+
100
+ const handleFaqItemScope = (isFaqActive: boolean, faqElementMaxCountInContents?: number): true | undefined => {
101
+ if (isFaqActive && faqElementMaxCountInContents === 0) {
102
+ return undefined;
103
+ }
104
+
105
+ if (isFaqActive && (faqElementMaxCountInContents as number) >= 2) {
106
+ return true;
107
+ }
108
+
109
+ return true;
110
+ };
111
+
112
+ const convertFaqItemType = (template: ISeoTemplateTypes): ISeoTemplateTypes => {
113
+ console.log('faqElementMaxCountInContents : ', faqElementMaxCountInContents);
114
+ if ((faqElementMaxCountInContents as number) >= 2) {
115
+ // 해당 게시글에 faqElementMaxCountInContents가 두 개 이상일 경우, template 내부에 FAQPage itemtype을 지운다. FAQPage 중복 이슈로 인한 코드임
116
+ template.description = template.description.replaceAll(
117
+ '&lt;div itemscope="" itemtype="https://schema.org/FAQPage"&gt;',
118
+ '&lt;div&gt;'
119
+ );
120
+
121
+ return template;
122
+ }
123
+
124
+ return template;
125
+ };
126
+
81
127
  // 변호사 6명 맞추기
82
128
  useEffect(() => {
83
129
  const originLawyerLength = lawyerData.length;
@@ -114,8 +160,8 @@ const SuccessNew = ({ data, tel }: ISuccessNewPageTypes) => {
114
160
 
115
161
  return (
116
162
  <div
117
- itemScope={isFaqActive ? undefined : true}
118
- itemType={isFaqActive ? undefined : 'https://schema.org/FAQPage'}
163
+ itemScope={handleFaqItemScope(isFaqActive, faqElementMaxCountInContents as number)}
164
+ itemType={handleFaqItemType(isFaqActive, faqElementMaxCountInContents as number)}
119
165
  ref={printRef}
120
166
  >
121
167
  <div className="relative m-auto mb-[100px] w-[90%] max-w-screen-2xl font-[SUIT] max-md2:mb-[40px] max-xs:mb-[30px]">
@@ -183,7 +229,11 @@ const SuccessNew = ({ data, tel }: ISuccessNewPageTypes) => {
183
229
  className={'mt-[52px] sm:mt-[62px] lg:mt-[75px]'}
184
230
  key={'h2영역' + h2Template.idx}
185
231
  >
186
- <H2Contents h2Template={h2Template} index={index} />
232
+ <H2Contents
233
+ h2Template={h2Template}
234
+ index={index}
235
+ faqCount={h2Template?.faqCount}
236
+ />
187
237
 
188
238
  {/*h3*/}
189
239
  {template
@@ -206,6 +256,7 @@ const SuccessNew = ({ data, tel }: ISuccessNewPageTypes) => {
206
256
  <H3Contents
207
257
  h3Template={h3Template}
208
258
  key={'h3영역' + h3Template.idx}
259
+ faqCount={h3Template?.faqCount}
209
260
  />
210
261
  {(refer_is_use &&
211
262
  refer_length > 0 &&
@@ -18,6 +18,7 @@ export interface ISuccessNewTypes {
18
18
  youtubeLinkList: IAddLinkTypes[];
19
19
  pn: PnType;
20
20
  initialData: IInitialDataTypes;
21
+ faqElementMaxCountInContents?: number;
21
22
  }
22
23
  export interface ISeoTemplateTypes {
23
24
  type: string;
@@ -19,6 +19,7 @@ export interface ISuccessNewTypes {
19
19
  youtubeLinkList: IAddLinkTypes[];
20
20
  pn: PnType;
21
21
  initialData: IInitialDataTypes;
22
+ faqElementMaxCountInContents?: number;
22
23
  }
23
24
 
24
25
  export interface ISeoTemplateTypes {
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import { ISeoTemplateTypes } from '../SuccessNewType';
3
- declare const H2Contents: ({ h2Template, index }: {
3
+ declare const H2Contents: ({ h2Template, index, faqCount }: {
4
4
  h2Template: ISeoTemplateTypes;
5
5
  index: number;
6
+ faqCount?: number;
6
7
  }) => React.JSX.Element;
7
8
  export default H2Contents;
@@ -1,17 +1,55 @@
1
1
  import React from 'react';
2
2
  import { htmlUrlDecode } from '../../../../lib';
3
- const H2Contents = ({ h2Template, index }) => {
3
+ const H2Contents = ({ h2Template, index, faqCount }) => {
4
4
  const { active_faq } = h2Template;
5
- return (<div itemScope={active_faq ? undefined : true} itemProp={active_faq ? '' : 'mainEntity'} itemType={active_faq ? '' : 'https://schema.org/Question'}>
6
- <h2 className={'flex h-fit w-full items-center break-keep rounded-[40px] bg-[#285FA7] py-[6.75px] pl-[40px] pr-[20px] -indent-[20px] text-[20px] font-bold leading-[28px] tracking-tight text-white sm:pl-[46px] sm:pr-[26px] sm:text-[26px] sm:leading-[34px] lg:pl-[53px] lg:pr-[33px] lg:text-[31.5px] lg:leading-[38px]'} id={h2Template.idx.toString()} itemProp={active_faq ? '' : 'name'}>
5
+ console.log('h2 active_faq :', active_faq);
6
+ console.log('h2 faqCount :', faqCount);
7
+ const getItemScope = () => {
8
+ if (active_faq === false && (faqCount === 0 || faqCount === undefined)) {
9
+ return true;
10
+ }
11
+ return undefined;
12
+ };
13
+ const getItemProp = (category) => {
14
+ if (active_faq === false && (faqCount === 0 || faqCount === undefined)) {
15
+ switch (category) {
16
+ case 'mainEntity':
17
+ return 'mainEntity';
18
+ case 'acceptedAnswer':
19
+ return 'acceptedAnswer';
20
+ case 'name':
21
+ return 'name';
22
+ case 'text':
23
+ return 'text';
24
+ default:
25
+ undefined;
26
+ }
27
+ }
28
+ return undefined;
29
+ };
30
+ const getItemType = (category) => {
31
+ if (active_faq === false && (faqCount === 0 || faqCount === undefined)) {
32
+ switch (category) {
33
+ case 'question':
34
+ return 'https://schema.org/Question';
35
+ case 'answer':
36
+ return 'https://schema.org/Answer';
37
+ default:
38
+ undefined;
39
+ }
40
+ }
41
+ return undefined;
42
+ };
43
+ return (<div itemScope={getItemScope()} itemProp={getItemProp('mainEntity')} itemType={getItemType('question')}>
44
+ <h2 className={'flex h-fit w-full items-center break-keep rounded-[40px] bg-[#285FA7] py-[6.75px] pl-[40px] pr-[20px] -indent-[20px] text-[20px] font-bold leading-[28px] tracking-tight text-white sm:pl-[46px] sm:pr-[26px] sm:text-[26px] sm:leading-[34px] lg:pl-[53px] lg:pr-[33px] lg:text-[31.5px] lg:leading-[38px]'} id={h2Template.idx.toString()} itemProp={getItemProp('name')}>
7
45
  {index + 1}. {h2Template.tag_title}
8
46
  </h2>
9
47
  <div className={'px-[10px] sm:px-[18px]'}>
10
48
  {/*h2 설명글*/}
11
- <div className={'lg::mt-[37.5px] mb-[44px] mt-[26px] whitespace-break-spaces text-[16px] tracking-[-0.69px] sm:mx-[20px] sm:mx-[33px] sm:mb-[50px] sm:mt-[32px] sm:text-[17.25px] lg:mb-[78px]'} itemScope={active_faq ? undefined : true} itemProp={active_faq ? '' : 'acceptedAnswer'} itemType={active_faq ? '' : 'https://schema.org/Answer'}>
12
- {h2Template.is_editor ? (<div itemProp={active_faq ? '' : 'text'} id={'ck-content'} dangerouslySetInnerHTML={{
49
+ <div className={'lg::mt-[37.5px] mb-[44px] mt-[26px] whitespace-break-spaces text-[16px] tracking-[-0.69px] sm:mx-[20px] sm:mx-[33px] sm:mb-[50px] sm:mt-[32px] sm:text-[17.25px] lg:mb-[78px]'} itemScope={getItemScope()} itemProp={getItemProp('acceptedAnswer')} itemType={getItemType('answer')}>
50
+ {h2Template.is_editor ? (<div itemProp={getItemProp('text')} id={'ck-content'} dangerouslySetInnerHTML={{
13
51
  __html: htmlUrlDecode(h2Template.description.replace('../../UploadFile', '/SE2/upload'))
14
- }}/>) : (<div itemProp={active_faq ? '' : 'text'}>{h2Template.description}</div>)}
52
+ }}/>) : (<div itemProp={getItemProp('text')}>{h2Template.description}</div>)}
15
53
  </div>
16
54
  </div>
17
55
  </div>);