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 +11 -0
- package/package.json +1 -1
- package/src/components/atoms/search/autocomplete/article/index.js +11 -8
- package/src/components/atoms/search/autocomplete/default/index.js +11 -8
- package/src/components/atoms/search/autocomplete/game/index.js +18 -15
- package/src/components/atoms/search/autocomplete/operator/index.js +18 -15
- package/src/components/organisms/search/index.js +1 -4
- package/src/constants/site-settings/main.js +1 -1
- package/src/helpers/autocomplete.js +8 -5
- package/src/helpers/autocomplete.test.js +48 -50
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
|
@@ -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
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
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 && (
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
/* eslint-disable import/prefer-default-export */
|
|
2
2
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
-
import
|
|
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
|
|
11
|
+
return Operator
|
|
9
12
|
case 'article':
|
|
10
|
-
return
|
|
13
|
+
return Article;
|
|
11
14
|
case 'game':
|
|
12
|
-
return
|
|
15
|
+
return Game
|
|
13
16
|
default:
|
|
14
|
-
return
|
|
17
|
+
return Default
|
|
15
18
|
}
|
|
16
19
|
}
|
|
@@ -1,75 +1,73 @@
|
|
|
1
1
|
/* eslint-disable no-unused-expressions */
|
|
2
|
-
import React
|
|
3
|
-
import { render
|
|
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(
|
|
10
|
-
render(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
22
|
-
expect(
|
|
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(
|
|
27
|
-
render(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
36
|
-
|
|
35
|
+
|
|
36
|
+
const link = container.querySelectorAll('a'); // gets <a>
|
|
37
|
+
expect(link[0]).toHaveAttribute("href", "/test");
|
|
37
38
|
|
|
38
|
-
|
|
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(
|
|
44
|
-
render(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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 =
|
|
53
|
-
expect(link).toHaveAttribute(
|
|
52
|
+
const link = container.querySelectorAll('a'); // gets <a>
|
|
53
|
+
expect(link[0]).toHaveAttribute("href", "/test");
|
|
54
54
|
|
|
55
|
-
|
|
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(
|
|
61
|
-
render(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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 =
|
|
70
|
-
expect(link).toHaveAttribute(
|
|
68
|
+
const link = container.querySelectorAll('a'); // gets <a>
|
|
69
|
+
expect(link[0]).toHaveAttribute("href", "/test");
|
|
71
70
|
|
|
72
|
-
|
|
73
|
-
expect(title).toBeInTheDocument();
|
|
71
|
+
expect(getByText('Test Default')).toBeInTheDocument();
|
|
74
72
|
});
|
|
75
73
|
});
|