gatsby-core-theme 44.0.38 → 44.0.39

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,14 @@
1
+ ## [44.0.39](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.0.38...v44.0.39) (2025-05-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * autocomplete bugs ([1d28271](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/1d28271a9ae73ddd67fdf6ca5b07a80da823058d))
7
+ * tests ([bebe108](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/bebe1080b8d528ca3f6aa67e6d85f61caa2f0c7a))
8
+
9
+
10
+ * Merge branch 'tm-4548-autocomplete-fixes' into 'master' ([126f205](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/126f205cc8bf59c4bee7edcab258fd455333510b))
11
+
1
12
  ## [44.0.38](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.0.37...v44.0.38) (2025-05-14)
2
13
 
3
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "44.0.38",
3
+ "version": "44.0.39",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -2,17 +2,20 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import Button from 'gatsby-core-theme/src/components/atoms/button/button';
4
4
  import { FaArrowRight } from '@react-icons/all-files/fa/FaArrowRight';
5
+ import Link from '~hooks/link';
5
6
  import styles from './article.module.scss';
6
7
 
7
8
  const Article = ({ item = {}, btnText = '', icon = <FaArrowRight title="Right-pointing Arrow Icon" /> }) => (
8
- <li className={styles.row || ''}>
9
- <h3 className={styles.operatorTitle}>{item.title}</h3>
10
- <Button
11
- btnText={btnText}
12
- to={item?.path}
13
- gtmClass="autocomplete-article-item-gtm btn-cta"
14
- icon={icon}
15
- />
9
+ <li>
10
+ <Link className={styles.row || ''} to={item?.path} title={item.title}>
11
+ <h3 className={styles.operatorTitle}>{item.title}</h3>
12
+ <Button
13
+ btnText={btnText}
14
+ to={item?.path}
15
+ gtmClass="autocomplete-article-item-gtm btn-cta"
16
+ icon={icon}
17
+ />
18
+ </Link>
16
19
  </li>
17
20
  );
18
21
 
@@ -2,17 +2,20 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import Button from 'gatsby-core-theme/src/components/atoms/button/button';
4
4
  import { FaArrowRight } from '@react-icons/all-files/fa/FaArrowRight';
5
+ import Link from '~hooks/link';
5
6
  import styles from './default.module.scss';
6
7
 
7
8
  const Default = ({ item = {}, btnText='', icon=<FaArrowRight title="Right-pointing Arrow Icon" /> }) => (
8
- <li className={styles.row || ''}>
9
- <h3 className={styles.operatorTitle}>{item.title}</h3>
10
- <Button
11
- btnText={btnText}
12
- to={item?.path}
13
- gtmClass="autocomplete-article-item-gtm btn-cta"
14
- icon={icon}
15
- />
9
+ <li>
10
+ <Link to={item?.path} title={item.title} className={styles.row || ''}>
11
+ <h3 className={styles.operatorTitle}>{item.title}</h3>
12
+ <Button
13
+ btnText={btnText}
14
+ to={item?.path}
15
+ gtmClass="autocomplete-article-item-gtm btn-cta"
16
+ icon={icon}
17
+ />
18
+ </Link>
16
19
  </li>
17
20
  );
18
21
 
@@ -4,27 +4,30 @@ import { FaArrowRight } from '@react-icons/all-files/fa/FaArrowRight';
4
4
  import Button from 'gatsby-core-theme/src/components/atoms/button/button';
5
5
  import LazyImage from '~hooks/lazy-image';
6
6
  import { imagePrettyUrl } from '~helpers/getters';
7
+ import Link from '~hooks/link';
7
8
  import styles from './game.module.scss';
8
9
 
9
10
  const Game = ({ item = {}, width = 56, height = 56, btnText = '', icon = <FaArrowRight title="Right-pointing Arrow Icon" /> }) => {
10
11
  const { logo } = item;
11
12
 
12
13
  return (
13
- <li className={styles.row || ''}>
14
- <LazyImage
15
- className={styles.gameImage}
16
- width={width}
17
- height={height}
18
- src={logo ? imagePrettyUrl(logo, width, height) : '/images/default-slot.jpg'}
19
- alt={item.title}
20
- />
21
- <h3 className={styles.gameTitle}>{item.title}</h3>
22
- <Button
23
- btnText={btnText}
24
- to={item?.path}
25
- gtmClass="autocomplete-game-item-gtm btn-cta"
26
- icon={icon}
27
- />
14
+ <li>
15
+ <Link to={item?.path} title={item.title} className={styles.row || ''}>
16
+ <LazyImage
17
+ className={styles.gameImage}
18
+ width={width}
19
+ height={height}
20
+ src={logo ? imagePrettyUrl(logo, width, height) : '/images/default-slot.jpg'}
21
+ alt={item.title}
22
+ />
23
+ <h3 className={styles.gameTitle}>{item.title}</h3>
24
+ <Button
25
+ btnText={btnText}
26
+ to={item?.path}
27
+ gtmClass="autocomplete-game-item-gtm btn-cta"
28
+ icon={icon}
29
+ />
30
+ </Link>
28
31
  </li>
29
32
  );
30
33
  };
@@ -4,27 +4,30 @@ import { FaArrowRight } from '@react-icons/all-files/fa/FaArrowRight';
4
4
  import Button from 'gatsby-core-theme/src/components/atoms/button/button';
5
5
  import LazyImage from '~hooks/lazy-image';
6
6
  import { imagePrettyUrl } from '~helpers/getters';
7
+ import Link from '~hooks/link';
7
8
  import styles from './operator.module.scss';
8
9
 
9
10
  const Operator = ({ item = {}, width = 56, height = 56, btnText = '', icon = <FaArrowRight title="Right-pointing Arrow Icon" /> }) => {
10
11
  const { logo } = item;
11
12
 
12
13
  return (
13
- <li className={styles.row || ''}>
14
- {logo && <LazyImage
15
- className={styles.operatorImage}
16
- width={width}
17
- height={height}
18
- src={imagePrettyUrl(logo, width, height)}
19
- alt={item.title}
20
- />}
21
- <h3 className={styles.operatorTitle}>{item.title}</h3>
22
- <Button
23
- to={item?.path}
24
- btnText={btnText}
25
- gtmClass="autocomplete-operator-item-gtm btn-cta"
26
- icon={icon}
27
- />
14
+ <li>
15
+ <Link to={item?.path} title={item.title} className={styles.row || ''}>
16
+ {logo && <LazyImage
17
+ className={styles.operatorImage}
18
+ width={width}
19
+ height={height}
20
+ src={imagePrettyUrl(logo, width, height)}
21
+ alt={item.title}
22
+ />}
23
+ <h3 className={styles.operatorTitle}>{item.title}</h3>
24
+ <Button
25
+ to={item?.path}
26
+ btnText={btnText}
27
+ gtmClass="autocomplete-operator-item-gtm btn-cta"
28
+ icon={icon}
29
+ />
30
+ </Link>
28
31
  </li>
29
32
  );
30
33
  };
@@ -1,14 +1,13 @@
1
1
  /* eslint-disable no-unused-expressions */
2
2
  /* eslint-disable no-console */
3
3
  /* eslint-disable react-hooks/rules-of-hooks */
4
- import React, { useRef, useState, useEffect, Suspense } from 'react';
4
+ import React, { useRef, useState, useEffect } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { BiSearchAlt } from '@react-icons/all-files/bi/BiSearchAlt';
7
7
  import { IoIosArrowForward } from "@react-icons/all-files/io/IoIosArrowForward";
8
8
  import loadSource from '../../../helpers/search-source';
9
9
  import useTranslate from '~hooks/useTranslate/useTranslate';
10
10
  import { toggleScroll } from '~helpers/scroll';
11
- import keygen from '~helpers/keygen';
12
11
  import { getComponent } from '../../../helpers/autocomplete';
13
12
  import Loading from '../../atoms/search/autocomplete/loading';
14
13
  import NoResults from '../../atoms/search/autocomplete/no-results';
@@ -202,9 +201,7 @@ const SearchForm = ({
202
201
  {items.slice(0, loadedCounts[type]).map((value) => {
203
202
  const PageTypeCard = getComponent(value.pageType);
204
203
  return (
205
- <Suspense fallback={<Loading single />} key={keygen()}>
206
204
  <PageTypeCard item={value} icon={autoCompleteIcon} />
207
- </Suspense>
208
205
  );
209
206
  })}
210
207
  {loadedCounts[type] < items.length && (
@@ -8,7 +8,7 @@ export const mainSettings = {
8
8
  },
9
9
  default: {
10
10
  operator_banner: false,
11
- autocomplete: false,
11
+ autocomplete: true,
12
12
  recommendedCasinos: true,
13
13
  topSearches: true,
14
14
  },
@@ -1,16 +1,19 @@
1
1
  /* eslint-disable import/prefer-default-export */
2
2
  // eslint-disable-next-line import/no-extraneous-dependencies
3
- import { lazy } from 'react';
3
+ import Operator from '../components/atoms/search/autocomplete/operator';
4
+ import Article from '../components/atoms/search/autocomplete/article';
5
+ import Game from '../components/atoms/search/autocomplete/game';
6
+ import Default from '../components/atoms/search/autocomplete/default';
4
7
 
5
8
  export function getComponent(type) {
6
9
  switch (type) {
7
10
  case 'operator':
8
- return lazy(() => import(`../components/atoms/search/autocomplete/operator`));
11
+ return Operator
9
12
  case 'article':
10
- return lazy(() => import(`../components/atoms/search/autocomplete/article`));
13
+ return Article;
11
14
  case 'game':
12
- return lazy(() => import(`../components/atoms/search/autocomplete/game`));
15
+ return Game
13
16
  default:
14
- return lazy(() => import(`../components/atoms/search/autocomplete/default`));
17
+ return Default
15
18
  }
16
19
  }
@@ -1,75 +1,73 @@
1
1
  /* eslint-disable no-unused-expressions */
2
- import React, { Suspense } from "react";
3
- import { render, screen } from "@testing-library/react";
2
+ import React from "react";
3
+ import { render } from "@testing-library/react";
4
4
  import "@testing-library/jest-dom/extend-expect";
5
5
  import { getComponent } from "./autocomplete";
6
6
 
7
7
  describe("Autocomplete Get Component Helper", () => {
8
8
  test("Autocomplete Get Component Operator", async () => {
9
- const Component = getComponent('operator');
10
- render(
11
- <Suspense fallback={<></>}>
12
- <Component item={{
13
- title: 'Test Operator',
14
- path: '/test'
15
- }} />
16
- </Suspense>
9
+ const Component = getComponent("operator");
10
+ const { container, getByText } = render(
11
+ <Component
12
+ item={{
13
+ title: "Test Operator",
14
+ path: "/test",
15
+ }}
16
+ />
17
17
  );
18
- const link = await screen.findByRole('link'); // gets <a>
19
- expect(link).toHaveAttribute('href', '/test');
20
18
 
21
- const title = await screen.findByText('Test Operator');
22
- expect(title).toBeInTheDocument();
19
+ const link = container.querySelectorAll('a'); // gets <a>
20
+ expect(link[0]).toHaveAttribute("href", "/test");
21
+
22
+ expect(getByText('Test Operator')).toBeInTheDocument();
23
23
  });
24
24
 
25
25
  test("Autocomplete Get Component Article", async () => {
26
- const Component = getComponent('article');
27
- render(
28
- <Suspense fallback={<></>}>
29
- <Component item={{
30
- title: 'Test Article',
31
- path: '/test'
32
- }} />
33
- </Suspense>
26
+ const Component = getComponent("article");
27
+ const { container, getByText } = render(
28
+ <Component
29
+ item={{
30
+ title: "Test Article",
31
+ path: "/test",
32
+ }}
33
+ />
34
34
  );
35
- const link = await screen.findByRole('link'); // gets <a>
36
- expect(link).toHaveAttribute('href', '/test');
35
+
36
+ const link = container.querySelectorAll('a'); // gets <a>
37
+ expect(link[0]).toHaveAttribute("href", "/test");
37
38
 
38
- const title = await screen.findByText('Test Article');
39
- expect(title).toBeInTheDocument();
39
+ expect(getByText('Test Article')).toBeInTheDocument();
40
40
  });
41
41
 
42
42
  test("Autocomplete Get Component Game", async () => {
43
- const Component = getComponent('game');
44
- render(
45
- <Suspense fallback={<></>}>
46
- <Component item={{
47
- title: 'Test Game',
48
- path: '/test'
49
- }} />
50
- </Suspense>
43
+ const Component = getComponent("game");
44
+ const { container, getByText } = render(
45
+ <Component
46
+ item={{
47
+ title: "Test Game",
48
+ path: "/test",
49
+ }}
50
+ />
51
51
  );
52
- const link = await screen.findByRole('link'); // gets <a>
53
- expect(link).toHaveAttribute('href', '/test');
52
+ const link = container.querySelectorAll('a'); // gets <a>
53
+ expect(link[0]).toHaveAttribute("href", "/test");
54
54
 
55
- const title = await screen.findByText('Test Game');
56
- expect(title).toBeInTheDocument();
55
+ expect(getByText('Test Game')).toBeInTheDocument();
57
56
  });
58
57
 
59
58
  test("Autocomplete Get Component Default", async () => {
60
- const Component = getComponent('payment_methods');
61
- render(
62
- <Suspense fallback={<></>}>
63
- <Component item={{
64
- title: 'Test Default',
65
- path: '/test'
66
- }} />
67
- </Suspense>
59
+ const Component = getComponent("payment_methods");
60
+ const { container, getByText } = render(
61
+ <Component
62
+ item={{
63
+ title: "Test Default",
64
+ path: "/test",
65
+ }}
66
+ />
68
67
  );
69
- const link = await screen.findByRole('link'); // gets <a>
70
- expect(link).toHaveAttribute('href', '/test');
68
+ const link = container.querySelectorAll('a'); // gets <a>
69
+ expect(link[0]).toHaveAttribute("href", "/test");
71
70
 
72
- const title = await screen.findByText('Test Default');
73
- expect(title).toBeInTheDocument();
71
+ expect(getByText('Test Default')).toBeInTheDocument();
74
72
  });
75
73
  });