@daeryun/dr_components 0.9.74 → 0.9.76

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.
@@ -2,19 +2,53 @@ 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
+ const getItemScope = () => {
8
+ if (active_faq || faqCount >= 2) {
9
+ return true;
10
+ }
11
+ return undefined;
12
+ };
13
+ const getItemProp = (category) => {
14
+ if (active_faq || faqCount >= 2) {
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: undefined;
25
+ }
26
+ }
27
+ return undefined;
28
+ };
29
+ const getItemType = (category) => {
30
+ if (active_faq || faqCount >= 2) {
31
+ switch (category) {
32
+ case "question":
33
+ return "https://schema.org/Question";
34
+ case "answer":
35
+ return "https://schema.org/Answer";
36
+ default: undefined;
37
+ }
38
+ }
39
+ return undefined;
40
+ };
7
41
  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'}>
42
+ <div className={'px-[10px] sm:px-[18px]'} key={'h3영역' + h3Template.idx} itemScope={getItemScope()} itemProp={getItemProp("mainEntity")} itemType={getItemType("question")}>
9
43
  {/*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'}>
44
+ <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
45
  {/*모든 seo 체크로 변경*/}
12
46
  <Image src={FieldIcon} alt={'h3 img'} width={27} height={26} className={'mr-[8px] h-auto max-sm:w-[22px]'}/>
13
47
  {h3Template.tag_title}
14
48
  </h3>
15
49
  {/*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={{
50
+ <div itemScope={getItemScope()} itemProp={getItemProp("acceptedAnswer")} itemType={getItemType("answer")}>
51
+ <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
52
  __html: htmlUrlDecode(h3Template.description.replace('../../UploadFile', '/SE2/upload'))
19
53
  }}></div>
20
54
  </div>
@@ -3,17 +3,60 @@ 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;
8
12
 
13
+ const getItemScope = (): boolean | undefined => {
14
+ if (active_faq || faqCount as number >= 2) {
15
+ return true;
16
+ }
17
+ return undefined;
18
+ };
19
+
20
+ const getItemProp = (category: ItemPropTypes): string | undefined => {
21
+ if (active_faq || faqCount as number >= 2) {
22
+ switch(category) {
23
+ case "mainEntity":
24
+ return "mainEntity";
25
+ case "acceptedAnswer":
26
+ return "acceptedAnswer";
27
+ case "name":
28
+ return "name";
29
+ case "text":
30
+ return "text";
31
+ default: undefined
32
+ }
33
+ }
34
+
35
+ return undefined;
36
+ };
37
+
38
+ const getItemType = (category: ItemTypes): string | undefined => {
39
+ if (active_faq || faqCount as number >= 2) {
40
+ switch(category) {
41
+ case "question":
42
+ return "https://schema.org/Question";
43
+ case "answer":
44
+ return "https://schema.org/Answer";
45
+ default: undefined
46
+ }
47
+ }
48
+
49
+ return undefined;
50
+ };
51
+
9
52
  return (
10
53
  <>
11
54
  <div
12
55
  className={'px-[10px] sm:px-[18px]'}
13
56
  key={'h3영역' + h3Template.idx}
14
- itemScope={active_faq ? undefined : true}
15
- itemProp={active_faq ? '' : 'mainEntity'}
16
- itemType={active_faq ? '' : 'https://schema.org/Question'}
57
+ itemScope={getItemScope()}
58
+ itemProp={getItemProp("mainEntity")}
59
+ itemType={getItemType("question")}
17
60
  >
18
61
  {/*h3*/}
19
62
  <h3
@@ -21,7 +64,7 @@ const H3Contents = ({ h3Template }: { h3Template: ISeoTemplateTypes }) => {
21
64
  '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
65
  }
23
66
  id={h3Template.idx.toString()}
24
- itemProp={active_faq ? '' : 'name'}
67
+ itemProp={getItemProp("name")}
25
68
  >
26
69
  {/*모든 seo 체크로 변경*/}
27
70
  <Image
@@ -35,15 +78,15 @@ const H3Contents = ({ h3Template }: { h3Template: ISeoTemplateTypes }) => {
35
78
  </h3>
36
79
  {/*h3 설명글*/}
37
80
  <div
38
- itemScope={active_faq ? undefined : true}
39
- itemProp={active_faq ? '' : 'acceptedAnswer'}
40
- itemType={active_faq ? '' : 'https://schema.org/Answer'}
81
+ itemScope={getItemScope()}
82
+ itemProp={getItemProp("acceptedAnswer")}
83
+ itemType={getItemType("answer")}
41
84
  >
42
85
  <div
43
86
  className={
44
87
  '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
88
  }
46
- itemProp={active_faq ? '' : 'text'}
89
+ itemProp={getItemProp("text")}
47
90
  id={'ck-content'}
48
91
  dangerouslySetInnerHTML={{
49
92
  __html: htmlUrlDecode(h3Template.description.replace('../../UploadFile', '/SE2/upload'))