@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,17 +3,65 @@ import Image from 'next/image';
3
3
  import { ISeoTemplateTypes } from '../SuccessNewType';
4
4
  import { htmlUrlDecode } from '../../../../lib';
5
5
  import FieldIcon from '../../../../asset/images/success_new/field_icon.webp';
6
- const H3Contents = ({ h3Template }: { h3Template: ISeoTemplateTypes }) => {
6
+
7
+ type ItemPropTypes = 'mainEntity' | 'acceptedAnswer' | 'name' | 'text';
8
+ type ItemTypes = 'question' | 'answer';
9
+
10
+ const H3Contents = ({ h3Template, faqCount }: { h3Template: ISeoTemplateTypes; faqCount?: number }) => {
7
11
  const { active_faq } = h3Template;
12
+ console.log('h3 active_faq :', active_faq);
13
+ console.log('h3 faqCount :', faqCount);
14
+
15
+ const getItemScope = (): boolean | undefined => {
16
+ if (active_faq === false && ((faqCount as number) === 0 || faqCount === undefined)) {
17
+ return true;
18
+ }
19
+
20
+ return undefined;
21
+ };
22
+
23
+ const getItemProp = (category: ItemPropTypes): string | undefined => {
24
+ if (active_faq === false && ((faqCount as number) === 0 || faqCount === undefined)) {
25
+ switch (category) {
26
+ case 'mainEntity':
27
+ return 'mainEntity';
28
+ case 'acceptedAnswer':
29
+ return 'acceptedAnswer';
30
+ case 'name':
31
+ return 'name';
32
+ case 'text':
33
+ return 'text';
34
+ default:
35
+ undefined;
36
+ }
37
+ }
38
+
39
+ return undefined;
40
+ };
41
+
42
+ const getItemType = (category: ItemTypes): string | undefined => {
43
+ if (active_faq === false && ((faqCount as number) === 0 || faqCount === undefined)) {
44
+ switch (category) {
45
+ case 'question':
46
+ return 'https://schema.org/Question';
47
+ case 'answer':
48
+ return 'https://schema.org/Answer';
49
+ default:
50
+ undefined;
51
+ }
52
+ }
53
+
54
+ return undefined;
55
+ };
8
56
 
9
57
  return (
10
58
  <>
11
59
  <div
12
60
  className={'px-[10px] sm:px-[18px]'}
13
61
  key={'h3영역' + h3Template.idx}
14
- itemScope={active_faq ? undefined : true}
15
- itemProp={active_faq ? '' : 'mainEntity'}
16
- itemType={active_faq ? '' : 'https://schema.org/Question'}
62
+ itemScope={getItemScope()}
63
+ itemProp={getItemProp('mainEntity')}
64
+ itemType={getItemType('question')}
17
65
  >
18
66
  {/*h3*/}
19
67
  <h3
@@ -21,7 +69,7 @@ const H3Contents = ({ h3Template }: { h3Template: ISeoTemplateTypes }) => {
21
69
  '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]'
22
70
  }
23
71
  id={h3Template.idx.toString()}
24
- itemProp={active_faq ? '' : 'name'}
72
+ itemProp={getItemProp('name')}
25
73
  >
26
74
  {/*모든 seo 체크로 변경*/}
27
75
  <Image
@@ -35,15 +83,15 @@ const H3Contents = ({ h3Template }: { h3Template: ISeoTemplateTypes }) => {
35
83
  </h3>
36
84
  {/*h3 설명글*/}
37
85
  <div
38
- itemScope={active_faq ? undefined : true}
39
- itemProp={active_faq ? '' : 'acceptedAnswer'}
40
- itemType={active_faq ? '' : 'https://schema.org/Answer'}
86
+ itemScope={getItemScope()}
87
+ itemProp={getItemProp('acceptedAnswer')}
88
+ itemType={getItemType('answer')}
41
89
  >
42
90
  <div
43
91
  className={
44
92
  '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]'
45
93
  }
46
- itemProp={active_faq ? '' : 'text'}
94
+ itemProp={getItemProp('text')}
47
95
  id={'ck-content'}
48
96
  dangerouslySetInnerHTML={{
49
97
  __html: htmlUrlDecode(h3Template.description.replace('../../UploadFile', '/SE2/upload'))