@daeryun/dr_components 1.0.16 → 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.
@@ -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>);
@@ -1,21 +1,73 @@
1
1
  import React from 'react';
2
2
  import { ISeoTemplateTypes } from '../SuccessNewType';
3
3
  import { htmlUrlDecode } from '../../../../lib';
4
- const H2Contents = ({ h2Template, index }: { h2Template: ISeoTemplateTypes; index: number }) => {
4
+
5
+ type ItemPropTypes = 'mainEntity' | 'acceptedAnswer' | 'name' | 'text';
6
+ type ItemTypes = 'question' | 'answer';
7
+
8
+ const H2Contents = ({
9
+ h2Template,
10
+ index,
11
+ faqCount
12
+ }: {
13
+ h2Template: ISeoTemplateTypes;
14
+ index: number;
15
+ faqCount?: number;
16
+ }) => {
5
17
  const { active_faq } = h2Template;
18
+ console.log('h2 active_faq :', active_faq);
19
+ console.log('h2 faqCount :', faqCount);
20
+
21
+ const getItemScope = (): boolean | undefined => {
22
+ if (active_faq === false && ((faqCount as number) === 0 || faqCount === undefined)) {
23
+ return true;
24
+ }
25
+
26
+ return undefined;
27
+ };
28
+
29
+ const getItemProp = (category: ItemPropTypes): string | undefined => {
30
+ if (active_faq === false && ((faqCount as number) === 0 || faqCount === undefined)) {
31
+ switch (category) {
32
+ case 'mainEntity':
33
+ return 'mainEntity';
34
+ case 'acceptedAnswer':
35
+ return 'acceptedAnswer';
36
+ case 'name':
37
+ return 'name';
38
+ case 'text':
39
+ return 'text';
40
+ default:
41
+ undefined;
42
+ }
43
+ }
44
+
45
+ return undefined;
46
+ };
47
+
48
+ const getItemType = (category: ItemTypes): string | undefined => {
49
+ if (active_faq === false && ((faqCount as number) === 0 || faqCount === undefined)) {
50
+ switch (category) {
51
+ case 'question':
52
+ return 'https://schema.org/Question';
53
+ case 'answer':
54
+ return 'https://schema.org/Answer';
55
+ default:
56
+ undefined;
57
+ }
58
+ }
59
+
60
+ return undefined;
61
+ };
6
62
 
7
63
  return (
8
- <div
9
- itemScope={active_faq ? undefined : true}
10
- itemProp={active_faq ? '' : 'mainEntity'}
11
- itemType={active_faq ? '' : 'https://schema.org/Question'}
12
- >
64
+ <div itemScope={getItemScope()} itemProp={getItemProp('mainEntity')} itemType={getItemType('question')}>
13
65
  <h2
14
66
  className={
15
67
  '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]'
16
68
  }
17
69
  id={h2Template.idx.toString()}
18
- itemProp={active_faq ? '' : 'name'}
70
+ itemProp={getItemProp('name')}
19
71
  >
20
72
  {index + 1}. {h2Template.tag_title}
21
73
  </h2>
@@ -25,20 +77,20 @@ const H2Contents = ({ h2Template, index }: { h2Template: ISeoTemplateTypes; inde
25
77
  className={
26
78
  '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]'
27
79
  }
28
- itemScope={active_faq ? undefined : true}
29
- itemProp={active_faq ? '' : 'acceptedAnswer'}
30
- itemType={active_faq ? '' : 'https://schema.org/Answer'}
80
+ itemScope={getItemScope()}
81
+ itemProp={getItemProp('acceptedAnswer')}
82
+ itemType={getItemType('answer')}
31
83
  >
32
84
  {h2Template.is_editor ? (
33
85
  <div
34
- itemProp={active_faq ? '' : 'text'}
86
+ itemProp={getItemProp('text')}
35
87
  id={'ck-content'}
36
88
  dangerouslySetInnerHTML={{
37
89
  __html: htmlUrlDecode(h2Template.description.replace('../../UploadFile', '/SE2/upload'))
38
90
  }}
39
91
  />
40
92
  ) : (
41
- <div itemProp={active_faq ? '' : 'text'}>{h2Template.description}</div>
93
+ <div itemProp={getItemProp('text')}>{h2Template.description}</div>
42
94
  )}
43
95
  </div>
44
96
  </div>
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ISeoTemplateTypes } from '../SuccessNewType';
3
- declare const H3Contents: ({ h3Template }: {
3
+ declare const H3Contents: ({ h3Template, faqCount }: {
4
4
  h3Template: ISeoTemplateTypes;
5
+ faqCount?: number;
5
6
  }) => React.JSX.Element;
6
7
  export default H3Contents;
@@ -2,19 +2,57 @@ import React from 'react';
2
2
  import Image from 'next/image';
3
3
  import { htmlUrlDecode } from '../../../../lib';
4
4
  import FieldIcon from '../../../../asset/images/success_new/field_icon.webp';
5
- const H3Contents = ({ h3Template }) => {
5
+ const H3Contents = ({ h3Template, faqCount }) => {
6
6
  const { active_faq } = h3Template;
7
+ console.log('h3 active_faq :', active_faq);
8
+ console.log('h3 faqCount :', faqCount);
9
+ const getItemScope = () => {
10
+ if (active_faq === false && (faqCount === 0 || faqCount === undefined)) {
11
+ return true;
12
+ }
13
+ return undefined;
14
+ };
15
+ const getItemProp = (category) => {
16
+ if (active_faq === false && (faqCount === 0 || faqCount === undefined)) {
17
+ switch (category) {
18
+ case 'mainEntity':
19
+ return 'mainEntity';
20
+ case 'acceptedAnswer':
21
+ return 'acceptedAnswer';
22
+ case 'name':
23
+ return 'name';
24
+ case 'text':
25
+ return 'text';
26
+ default:
27
+ undefined;
28
+ }
29
+ }
30
+ return undefined;
31
+ };
32
+ const getItemType = (category) => {
33
+ if (active_faq === false && (faqCount === 0 || faqCount === undefined)) {
34
+ switch (category) {
35
+ case 'question':
36
+ return 'https://schema.org/Question';
37
+ case 'answer':
38
+ return 'https://schema.org/Answer';
39
+ default:
40
+ undefined;
41
+ }
42
+ }
43
+ return undefined;
44
+ };
7
45
  return (<>
8
- <div className={'px-[10px] sm:px-[18px]'} key={'h3영역' + h3Template.idx} itemScope={active_faq ? undefined : true} itemProp={active_faq ? '' : 'mainEntity'} itemType={active_faq ? '' : 'https://schema.org/Question'}>
46
+ <div className={'px-[10px] sm:px-[18px]'} key={'h3영역' + h3Template.idx} itemScope={getItemScope()} itemProp={getItemProp('mainEntity')} itemType={getItemType('question')}>
9
47
  {/*h3*/}
10
- <h3 className={'mb-[16px] flex items-center break-keep text-[18px] font-bold tracking-[-0.96px] text-[#285FA7] sm:mb-[18px] sm:text-[22px] lg:mb-[22.5px] lg:text-[24px]'} id={h3Template.idx.toString()} itemProp={active_faq ? '' : 'name'}>
48
+ <h3 className={'mb-[16px] flex items-center break-keep text-[18px] font-bold tracking-[-0.96px] text-[#285FA7] sm:mb-[18px] sm:text-[22px] lg:mb-[22.5px] lg:text-[24px]'} id={h3Template.idx.toString()} itemProp={getItemProp('name')}>
11
49
  {/*모든 seo 체크로 변경*/}
12
50
  <Image src={FieldIcon} alt={'h3 img'} width={27} height={26} className={'mr-[8px] h-auto max-sm:w-[22px]'}/>
13
51
  {h3Template.tag_title}
14
52
  </h3>
15
53
  {/*h3 설명글*/}
16
- <div itemScope={active_faq ? undefined : true} itemProp={active_faq ? '' : 'acceptedAnswer'} itemType={active_faq ? '' : 'https://schema.org/Answer'}>
17
- <div className={'mb-[44px] whitespace-break-spaces text-[16px] tracking-[-0.69px] sm:mx-[20px] sm:mx-[33px] sm:mb-[50px] sm:text-[17.25px] lg:mb-[78px]'} itemProp={active_faq ? '' : 'text'} id={'ck-content'} dangerouslySetInnerHTML={{
54
+ <div itemScope={getItemScope()} itemProp={getItemProp('acceptedAnswer')} itemType={getItemType('answer')}>
55
+ <div className={'mb-[44px] whitespace-break-spaces text-[16px] tracking-[-0.69px] sm:mx-[20px] sm:mx-[33px] sm:mb-[50px] sm:text-[17.25px] lg:mb-[78px]'} itemProp={getItemProp('text')} id={'ck-content'} dangerouslySetInnerHTML={{
18
56
  __html: htmlUrlDecode(h3Template.description.replace('../../UploadFile', '/SE2/upload'))
19
57
  }}></div>
20
58
  </div>