gatsby-core-theme 20.0.0 → 20.0.2

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,38 @@
1
+ ## [20.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v20.0.1...v20.0.2) (2023-04-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fix for tnc issue on matrix ([b0fe49e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b0fe49e5d344aad42b311e343ee1c5e2b697ad37))
7
+
8
+
9
+ ### Code Refactoring
10
+
11
+ * correction to tnc props ([6ea3616](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6ea3616ef5fcf5dad80801a130971ea50cd7ded6))
12
+ * update page.relation check in processor ([ab92c2d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ab92c2d78808d06eb4fa40aa94332d4194587b8b))
13
+
14
+
15
+ * Merge branch 'tm-tnc-issue' into 'master' ([d29e1aa](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d29e1aab514b494197ab1f305e308d03ce776e9a))
16
+
17
+ ## [20.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v20.0.0...v20.0.1) (2023-04-12)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * faq core ([d2d96fc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d2d96fc71c88241b5a565923932fe21306a8026f))
23
+ * test ([d4044db](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d4044db27e0e5ec4eb9978f914c28113552c383c))
24
+
25
+
26
+ ### Code Refactoring
27
+
28
+ * fix tests ([55dcc03](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/55dcc03d7ae2dfb1bd8d71f8790c964a45db1a22))
29
+ * remove use is mobile from menu item and collapse ([fc62fb4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fc62fb4247f4d185ce5592d936309d638a9d852c))
30
+ * update realtions in processor ([ae86616](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ae86616d32e3d05ee2fe1fcfe073a13929df8ac8))
31
+
32
+
33
+ * Merge branch 'tm-3381-faq-core' into 'master' ([1756bac](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1756bac45b1df4de4f067de8c9a49e3b76dcab65))
34
+ * Merge branch 'tm-3325-remove-useismobile-func' into 'master' ([a2f82af](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a2f82af27ee9fda84a449b56b7989ac195ace6dd))
35
+
1
36
  # [20.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v19.0.1...v20.0.0) (2023-04-10)
2
37
 
3
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "20.0.0",
3
+ "version": "20.0.2",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -1,15 +1,28 @@
1
1
  .collapseContainer {
2
2
  .button {
3
+ display: none;
3
4
  position: relative;
4
5
  font-size: 1.6rem;
5
6
 
6
7
  &:after {
7
8
  transition: 0.5s;
8
- @include arrow(var(--color-20), .8rem, down, false, translateY(-50%));
9
+ @include arrow(var(--color-20), 0.8rem, down, false, translateY(-50%));
9
10
  position: absolute;
10
11
  left: 115%;
11
12
  top: 42%;
12
13
  }
14
+
15
+ &.buttonM {
16
+ @include max(tablet) {
17
+ display: block;
18
+ }
19
+ }
20
+
21
+ &.buttonD {
22
+ @include min(tablet) {
23
+ display: block;
24
+ }
25
+ }
13
26
  }
14
27
 
15
28
  .active {
@@ -18,10 +31,21 @@
18
31
  }
19
32
  }
20
33
 
21
- .content {
22
- overflow: hidden;
23
- max-height: 0;
24
- font-size: 1.6rem;
25
- transition: max-height 0.3s ease-out;
34
+ .contentM {
35
+ @include max(tablet) {
36
+ overflow: hidden;
37
+ max-height: 0;
38
+ font-size: 1.6rem;
39
+ transition: max-height 0.3s ease-out;
40
+ }
41
+ }
42
+
43
+ .contentD {
44
+ @include min(tablet) {
45
+ overflow: hidden;
46
+ max-height: 0;
47
+ font-size: 1.6rem;
48
+ transition: max-height 0.3s ease-out;
49
+ }
26
50
  }
27
51
  }
@@ -42,7 +42,7 @@ describe('Collapse Component', () => {
42
42
  <Collapse buttonText="Open" contentText="Content Text" onlyMobile />
43
43
  );
44
44
 
45
- expect(container.querySelector('button')).toBeFalsy();
45
+ expect(container.querySelector('button')).toBeTruthy();
46
46
  });
47
47
  });
48
48
  afterEach(() => {
@@ -2,7 +2,6 @@ import React, { useState, useRef, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
4
  import styles from './collapse.module.scss';
5
- import useIsMobile from '~hooks/useIsMobile';
6
5
 
7
6
  const Collapse = ({
8
7
  buttonText,
@@ -14,8 +13,6 @@ const Collapse = ({
14
13
  }) => {
15
14
  const [maxHeightStyle, setMaxHeightStyle] = useState(maxHeight);
16
15
  const contentRef = useRef(React.createRef());
17
- let showButton = true;
18
- const isMobile = useIsMobile();
19
16
 
20
17
  useEffect(() => {
21
18
  if (initOpen) {
@@ -31,30 +28,24 @@ const Collapse = ({
31
28
  }
32
29
  };
33
30
 
34
- if (onlyMobile || onlyDesktop) {
35
- if ((onlyMobile && !isMobile) || (onlyDesktop && isMobile)) {
36
- showButton = false;
37
- }
38
- }
39
-
40
31
  return (
41
32
  <div className={styles.collapseContainer}>
42
33
  <div className={maxHeightStyle !== 0 ? styles.active : null}>
43
- {showButton && (
44
- <button
45
- type="button"
46
- onClick={clickHandler}
47
- className={`${styles.button} ${
48
- maxHeightStyle !== 0 ? styles.invertArrow : ''
49
- } collapse-gtm btn-cta`}
50
- >
51
- {buttonText}
52
- </button>
53
- )}
34
+ <button
35
+ type="button"
36
+ onClick={clickHandler}
37
+ className={`${onlyMobile ? styles.buttonM : ''} ${onlyDesktop ? styles.buttonD : ''} ${
38
+ styles.button
39
+ } ${maxHeightStyle !== 0 ? styles.invertArrow : ''} collapse-gtm btn-cta`}
40
+ >
41
+ {buttonText}
42
+ </button>
54
43
  <div
55
44
  ref={contentRef}
56
- className={showButton ? styles.content : null}
57
- style={showButton ? { maxHeight: maxHeightStyle } : {}}
45
+ className={`${onlyMobile ? styles.contentM : ''} ${onlyDesktop ? styles.contentD : ''} ${
46
+ styles.content
47
+ }`}
48
+ style={onlyMobile || onlyDesktop ? { maxHeight: maxHeightStyle } : {}}
58
49
  >
59
50
  {contentText}
60
51
  </div>
@@ -2,7 +2,6 @@
2
2
  import React, { useState, useEffect, useContext } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import Link from '~hooks/link';
5
- import useIsMobile from '~hooks/useIsMobile';
6
5
  import ConditionalWrapper from '~atoms/conditional-wrapper';
7
6
  import { imagePrettyUrl } from '~helpers/getters';
8
7
  import { NavigationContext } from '~organisms/navigation/navigationContext';
@@ -40,7 +39,6 @@ export default function Item({
40
39
  e.target.classList.toggle(styles.active);
41
40
  setOpened(e.target.classList.contains(styles.active));
42
41
  };
43
- const isMobile = useIsMobile();
44
42
 
45
43
  const ItemImage = () =>
46
44
  item.image ? (
@@ -52,9 +50,7 @@ export default function Item({
52
50
  condition={hasChildren}
53
51
  wrapper={(items) => (
54
52
  <div
55
- className={`${styles.itemWrapper} ${item.image && styles.itemWrapperIcon} ${
56
- options.mobile.subMenuDropDownButton && isMobile ? styles.dropDownButton : ''
57
- }`}
53
+ className={`${styles.itemWrapper} ${item.image && styles.itemWrapperIcon}`}
58
54
  onTouchStart={!options.mobile.subMenuDropDownButton ? showSubMenuHandler : null}
59
55
  >
60
56
  {items}
@@ -69,9 +65,7 @@ export default function Item({
69
65
  rel={`noreferrer ${item.nofollow && 'nofollow'}`}
70
66
  target="_blank"
71
67
  className={`${gtmClass} ${styles.item} ${opened && styles.openedLink} ${active} ${
72
- !options.mobile.subMenuDropDownButton && isMobile && hasChildren
73
- ? styles.inactiveLink
74
- : ''
68
+ !options.mobile.subMenuDropDownButton && hasChildren ? styles.inactiveLink : ''
75
69
  } ${hasChildren ? styles.hasChildren : ''} ${
76
70
  !options.mobile.subMenuDropDownButton ? styles.noDropDownButton : ''
77
71
  }`}
@@ -82,9 +76,7 @@ export default function Item({
82
76
  ) : item.value !== null ? (
83
77
  <Link
84
78
  className={`${gtmClass} ${styles.item} ${opened && styles.openedLink} ${active} ${
85
- !options.mobile.subMenuDropDownButton && isMobile && hasChildren
86
- ? styles.inactiveLink
87
- : ''
79
+ !options.mobile.subMenuDropDownButton && hasChildren ? styles.inactiveLink : ''
88
80
  } ${hasChildren ? styles.hasChildren : ''} ${
89
81
  !options.mobile.subMenuDropDownButton ? styles.noDropDownButton : ''
90
82
  }`}
@@ -24,10 +24,8 @@
24
24
  }
25
25
 
26
26
  &.inactiveLink {
27
- position: relative;
28
- pointer-events: none;
29
-
30
27
  @include max(tablet) {
28
+ position: relative;
31
29
  pointer-events: none;
32
30
  }
33
31
  }
@@ -40,15 +38,15 @@
40
38
  max-width: 75px;
41
39
  position: relative;
42
40
  background-color: var(--primary-hover-color);
43
-
41
+
44
42
  &.active {
45
43
  @include arrow-rotate(0);
46
44
  }
47
-
45
+
48
46
  &:after {
49
47
  transition: 0.2s;
50
48
  @include arrow(var(--nav-icon-color), 1rem, down, false);
51
-
49
+
52
50
  position: absolute;
53
51
  top: calc(50% - 0.4rem);
54
52
  left: calc(50% - 1.2rem);
@@ -29,7 +29,10 @@ const Modules = ({ module, page, pageContext }) => {
29
29
  case 'pros_and_cons':
30
30
  return loadable(() => import('~molecules/pros-cons'));
31
31
  case 'faq':
32
- return loadable(() => import('~atoms/faq'));
32
+ if (moduleItem?.display_front_end === '1') {
33
+ return loadable(() => import('~atoms/faq'));
34
+ }
35
+ return null;
33
36
  case 'accordion':
34
37
  return loadable(() => import('~organisms/accordion'));
35
38
  case 'anchor':
@@ -6,8 +6,8 @@ import Collapse from '~atoms/collapse';
6
6
 
7
7
  const Tnc = ({
8
8
  hasCollapse = true,
9
- onlyMobile,
10
- onlyDesktop,
9
+ onlyMobile = true,
10
+ onlyDesktop = true,
11
11
  buttonText = 'Terms and Conditions Apply',
12
12
  contentText = '18+ New Players only. Play responsibly.',
13
13
  initOpen = false,
@@ -143,8 +143,8 @@ export const Default = Template.bind({});
143
143
  Default.args = {
144
144
  hasCollapse: true,
145
145
  contentText: tncText,
146
- onlyMobile: false,
147
- onlyDesktop: false,
146
+ onlyMobile: true,
147
+ onlyDesktop: true,
148
148
  buttonText: 'Terms and Conditions Apply',
149
149
  initOpen: false,
150
150
  isFixed: false,
@@ -9,10 +9,11 @@ export const processRelations = (page, pageType, transformedPages, market, data,
9
9
  switch (page.relation_type) {
10
10
  // Add path for payment page from payment method
11
11
  case 'operator':
12
- if (hasRelation) {
12
+ if (page.relation && hasRelation) {
13
13
  // eslint-disable-next-line camelcase, prefer-const
14
14
  const { ribbons, extra_fields, bonus } = page.relation;
15
- bonus.deposit_methods &&
15
+ bonus &&
16
+ bonus.deposit_methods &&
16
17
  bonus.deposit_methods.forEach((e) => {
17
18
  const el =
18
19
  transformedPages[market].payment_method &&
@@ -24,11 +25,12 @@ export const processRelations = (page, pageType, transformedPages, market, data,
24
25
  page.relation.email = support_email || page.relation.email;
25
26
  page.relation.name = operator_name || page.relation.name;
26
27
  // eslint-disable-next-line no-unused-expressions
27
- ribbons.length > 0 &&
28
+ ribbons &&
29
+ ribbons.length > 0 &&
28
30
  ribbons.forEach((res, index) => {
29
31
  ribbons[index] = data.ribbons[res] ? data.ribbons[res].label : res;
30
32
  });
31
- if (ribbons.length === 0 && extra_fields.ribbon_text) {
33
+ if (ribbons && ribbons.length === 0 && extra_fields.ribbon_text) {
32
34
  page.relation.ribbons = extra_fields.ribbon_text.split(',');
33
35
  }
34
36
  }
@@ -190,21 +190,24 @@ export function moduleSchemas(modules, path) {
190
190
  const schema = modules.map((module, index) => {
191
191
  switch (module.name) {
192
192
  case 'faq': {
193
- const moduleSchema = {
194
- '@context': 'https://schema.org',
195
- '@type': 'FAQPage',
196
- '@id': `${getUrl(path)}#faqpage${index === 0 ? '' : index}`,
197
- mainEntity: module.items?.map((item) => ({
198
- '@type': 'Question',
199
- acceptedAnswer: {
200
- '@type': 'Answer',
201
- text: cleanHTML(item.answer),
202
- },
203
- name: cleanHTML(item.question),
204
- })),
205
- };
193
+ if (module?.render_schema === '1') {
194
+ const moduleSchema = {
195
+ '@context': 'https://schema.org',
196
+ '@type': 'FAQPage',
197
+ '@id': `${getUrl(path)}#faqpage${index === 0 ? '' : index}`,
198
+ mainEntity: module.items?.map((item) => ({
199
+ '@type': 'Question',
200
+ acceptedAnswer: {
201
+ '@type': 'Answer',
202
+ text: cleanHTML(item.answer),
203
+ },
204
+ name: cleanHTML(item.question),
205
+ })),
206
+ };
206
207
 
207
- return JSON.stringify(generateSchemaObject(moduleSchema));
208
+ return JSON.stringify(generateSchemaObject(moduleSchema));
209
+ }
210
+ return null;
208
211
  }
209
212
  default: {
210
213
  return null;
@@ -167,6 +167,7 @@ describe('Schema Helper', () => {
167
167
  [
168
168
  {
169
169
  name: 'faq',
170
+ render_schema: '1',
170
171
  items: [
171
172
  { answer: 'Answer A', question: 'Question A' },
172
173
  { answer: 'Answer B', question: 'Question B' },
@@ -390,7 +391,7 @@ describe('Schema Helper', () => {
390
391
  breadcrumbs: [{ path: '/test' }],
391
392
  relation_type: 'article',
392
393
  path: '/test-path',
393
- sections: { main: { modules: [{ name: 'faq' }] } },
394
+ sections: { main: { modules: [{ name: 'faq', render_schema: '1' }] } },
394
395
  });
395
396
 
396
397
  expect(Object.prototype.toString.call(output)).toEqual('[object Array]');