@daeryun/dr_components 0.9.76 → 0.9.78

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.
@@ -82,15 +82,22 @@ const LawInfoNew = ({ data, tel }) => {
82
82
  }
83
83
  return undefined;
84
84
  };
85
+ const handleFaqItemScope = (isFaqActive, faqCount) => {
86
+ let isActive = faqCount >= 2 ? true : false;
87
+ if (isFaqActive || isActive) {
88
+ return true;
89
+ }
90
+ return undefined;
91
+ };
85
92
  const convertFaqItemType = (template) => {
86
93
  if (faqCount >= 2) {
87
- template.description = template.description.replaceAll('itemtype="https://schema.org/FAQPage"', '');
88
- console.log('변경된 template : ', template);
94
+ template.description = template.description
95
+ .replace(/itemtype\s*=\s*["']https:\/\/schema\.org\/FAQPage["']/gi, '');
89
96
  return template;
90
97
  }
91
98
  return template;
92
99
  };
93
- return (<div itemScope={isFaqActive ? undefined : true} itemType={handleFaqItemType(isFaqActive, faqCount)} ref={printRef}>
100
+ return (<div itemScope={handleFaqItemScope(isFaqActive, faqCount)} itemType={handleFaqItemType(isFaqActive, faqCount)} ref={printRef}>
94
101
  <div id={'sub_contents'}>
95
102
  <div className="font-[SUIT]] relative m-auto mb-[60px] w-[90%] max-w-screen-2xl max-xs:mb-[30px]">
96
103
  <div className={'m-auto mt-[100px] flex gap-[120px] lg:mt-[5em] ' +
@@ -104,7 +104,7 @@ const LawInfoNew = ({ data, tel }: ILawInfoNewPageTypes) => {
104
104
 
105
105
  console.log('faqCount : ', faqCount);
106
106
 
107
- const handleFaqItemType = (isFaqActive: boolean, faqCount: number) => {
107
+ const handleFaqItemType = (isFaqActive: boolean, faqCount: number): string | undefined => {
108
108
  let isActive = faqCount >= 2 ? true : false;
109
109
 
110
110
  if (isFaqActive || isActive) {
@@ -114,10 +114,21 @@ const LawInfoNew = ({ data, tel }: ILawInfoNewPageTypes) => {
114
114
  return undefined;
115
115
  };
116
116
 
117
- const convertFaqItemType = (template: ISeoTemplateTypes) => {
117
+ const handleFaqItemScope = (isFaqActive: boolean, faqCount: number): boolean | undefined => {
118
+ let isActive = faqCount >= 2 ? true : false;
119
+
120
+ if (isFaqActive || isActive) {
121
+ return true;
122
+ }
123
+
124
+ return undefined;
125
+ };
126
+
127
+ const convertFaqItemType = (template: ISeoTemplateTypes): ISeoTemplateTypes => {
118
128
  if (faqCount as number >= 2) {
119
- template.description = template.description.replaceAll('itemtype="https://schema.org/FAQPage"', '');
120
- console.log('변경된 template : ', template);
129
+ template.description = template.description
130
+ .replace(/itemtype\s*=\s*["']https:\/\/schema\.org\/FAQPage["']/gi, '');
131
+
121
132
  return template;
122
133
  }
123
134
 
@@ -126,7 +137,7 @@ const LawInfoNew = ({ data, tel }: ILawInfoNewPageTypes) => {
126
137
 
127
138
  return (
128
139
  <div
129
- itemScope={isFaqActive ? undefined : true}
140
+ itemScope={handleFaqItemScope(isFaqActive, faqCount as number)}
130
141
  itemType={handleFaqItemType(isFaqActive, faqCount as number)}
131
142
  ref={printRef}
132
143
  >