gatsby-matrix-theme 2.3.6 → 3.0.1

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/package.json +2 -2
  3. package/src/components/atoms/author-card/author-card.module.scss +44 -0
  4. package/src/components/atoms/author-card/author-card.stories.js +47 -0
  5. package/src/components/atoms/author-card/author-card.test.js +29 -0
  6. package/src/components/atoms/author-card/index.js +41 -0
  7. package/src/components/atoms/cards/article-card/index.js +1 -1
  8. package/src/components/atoms/cards/game-card/index.js +1 -1
  9. package/src/components/atoms/cards/operator-card/index.js +8 -13
  10. package/src/components/atoms/cards/payment-method-card/index.js +5 -1
  11. package/src/components/atoms/cards/software-provider-card/index.js +5 -1
  12. package/src/components/atoms/search/autocomplete/article.js +9 -2
  13. package/src/components/atoms/search/autocomplete/game.js +9 -2
  14. package/src/components/atoms/search/autocomplete/operator.js +9 -2
  15. package/src/components/atoms/search/autocomplete/payment_methods.js +9 -2
  16. package/src/components/atoms/search/autocomplete/software_provider.js +9 -2
  17. package/src/components/atoms/social-icons/index.js +56 -0
  18. package/src/components/atoms/social-icons/social-icons.module.scss +33 -0
  19. package/src/components/atoms/social-icons/social-icons.stories.js +55 -0
  20. package/src/components/atoms/social-icons/social-icons.test.js +31 -0
  21. package/src/components/molecules/small-welcome-bonus/index.js +1 -0
  22. package/src/components/organisms/footer-navigation/index.js +1 -1
  23. package/src/components/pages/contact-us/contact-us.module.scss +86 -0
  24. package/src/components/pages/contact-us/contact-us.stories.js +92 -0
  25. package/src/components/pages/contact-us/contact-us.test.js +26 -0
  26. package/src/components/pages/contact-us/index.js +85 -3
  27. package/src/gatsby-core-theme/components/molecules/search/index.js +1 -1
  28. package/src/gatsby-core-theme/components/organisms/cards/index.js +7 -1
  29. package/src/gatsby-core-theme/components/organisms/head/index.js +4 -6
  30. package/src/gatsby-core-theme/components/organisms/navigation/index.js +12 -3
  31. package/src/gatsby-core-theme/components/organisms/search/index.js +6 -6
  32. package/src/helpers/splitSearchQuery.js +3 -0
  33. package/src/hooks/tabs/index.js +3 -0
  34. package/storybook/public/0.4437e7af.iframe.bundle.js +1 -0
  35. package/storybook/public/{1.b16d9cbb.iframe.bundle.js → 1.d51717ce.iframe.bundle.js} +1 -1
  36. package/storybook/public/10.f7f3ccb8.iframe.bundle.js +1 -0
  37. package/storybook/public/11.13224d48.iframe.bundle.js +1 -0
  38. package/storybook/public/12.977cb5d6.iframe.bundle.js +1 -0
  39. package/storybook/public/13.183d3f1c.iframe.bundle.js +1 -0
  40. package/storybook/public/{10.f8a18169.iframe.bundle.js → 14.708f714b.iframe.bundle.js} +1 -1
  41. package/storybook/public/{11.7ed16ae2.iframe.bundle.js → 15.f1ca69f8.iframe.bundle.js} +1 -1
  42. package/storybook/public/5.55e44ad1.iframe.bundle.js +3 -0
  43. package/storybook/public/{5.3bdb3f72.iframe.bundle.js.LICENSE.txt → 5.55e44ad1.iframe.bundle.js.LICENSE.txt} +0 -0
  44. package/storybook/public/5.55e44ad1.iframe.bundle.js.map +1 -0
  45. package/storybook/public/6.6873cebc.iframe.bundle.js +1 -0
  46. package/storybook/public/7.c27a05d3.iframe.bundle.js +1 -0
  47. package/storybook/public/{8.1df784e4.iframe.bundle.js → 8.d69edd98.iframe.bundle.js} +3 -3
  48. package/storybook/public/{8.1df784e4.iframe.bundle.js.LICENSE.txt → 8.d69edd98.iframe.bundle.js.LICENSE.txt} +0 -0
  49. package/storybook/public/8.d69edd98.iframe.bundle.js.map +1 -0
  50. package/storybook/public/{9.d2817f50.iframe.bundle.js → 9.d991c97a.iframe.bundle.js} +1 -1
  51. package/storybook/public/iframe.html +1 -1
  52. package/storybook/public/main.a057c3f0.iframe.bundle.js +1 -0
  53. package/storybook/public/runtime~main.ce5aea2d.iframe.bundle.js +1 -0
  54. package/storybook/public/vendors~main.a952f647.iframe.bundle.js +7 -0
  55. package/storybook/public/{vendors~main.c0720eee.iframe.bundle.js.LICENSE.txt → vendors~main.a952f647.iframe.bundle.js.LICENSE.txt} +0 -0
  56. package/storybook/public/vendors~main.a952f647.iframe.bundle.js.map +1 -0
  57. package/storybook/public/0.32053ec6.iframe.bundle.js +0 -1
  58. package/storybook/public/5.3bdb3f72.iframe.bundle.js +0 -3
  59. package/storybook/public/5.3bdb3f72.iframe.bundle.js.map +0 -1
  60. package/storybook/public/6.d5dd48d0.iframe.bundle.js +0 -1
  61. package/storybook/public/7.99f26915.iframe.bundle.js +0 -1
  62. package/storybook/public/8.1df784e4.iframe.bundle.js.map +0 -1
  63. package/storybook/public/main.927cac84.iframe.bundle.js +0 -1
  64. package/storybook/public/runtime~main.76a8717d.iframe.bundle.js +0 -1
  65. package/storybook/public/vendors~main.c0720eee.iframe.bundle.js +0 -7
  66. package/storybook/public/vendors~main.c0720eee.iframe.bundle.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,70 @@
1
+ ## [3.0.1](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v3.0.0...v3.0.1) (2021-11-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * core theme update and general fixes ([26fe04d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/26fe04d969b8bd0d0505e576c2422e4c8a7a2653))
7
+ * translation fix ([d115bc0](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/d115bc0f7d4d032107eb62033d54fa9952a17fc8))
8
+
9
+
10
+ * Merge branch 'general_fixes' into 'master' ([ae536eb](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/ae536eb6882679b2495bce34b557144753c7c6c9))
11
+
12
+ # [3.0.0](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v2.3.8...v3.0.0) (2021-11-24)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * accessibility fixes ([d43d834](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/d43d83448879a5806c6927ec35942dee2b5c2236))
18
+ * tab change lazyload issue ([f41e887](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/f41e887022bc4779f411ff1a9fffe3e158fcc8cb))
19
+
20
+
21
+ ### Code Refactoring
22
+
23
+ * fixes on accessibility ([946ec97](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/946ec9757eee7d8a77b4a5be830d860409a6b4c8))
24
+
25
+
26
+ ### Config
27
+
28
+ * updated core theme version ([d7f394d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/d7f394d5c312f1dc2e1a09a57a5b6f7829529158))
29
+
30
+
31
+ * Merge branch 'tm-2478-search' into 'master' ([47022c5](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/47022c50b9ee86cada8cfab92acfce25afe6216d))
32
+ * Merge branch 'master' into tm-2478-search ([24c25cd](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/24c25cd408240021bc6c67b6c1e4983e222e25bf))
33
+ * Merge branch 'tm-2595-accessibility-scores' into 'master' ([191f7ce](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/191f7cee4eedeee855e8848d20c6910ff1db1195))
34
+
35
+ ## [2.3.8](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v2.3.7...v2.3.8) (2021-11-23)
36
+
37
+
38
+ ### Bug Fixes
39
+
40
+ * contact us page template ([4960ca9](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/4960ca912a5eb8f0b2f9ce6aaf27a27d84cbe7be))
41
+ * contact us template ([d85be6f](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/d85be6fee147dd9f7b998865df12d9f41358a01c))
42
+ * follow us ([02699fc](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/02699fc26abf94f85c844e2716728d85f0853e68))
43
+ * merged master branch ([cb5ce66](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/cb5ce66f2882e9da0e3bd8c25daf85eab8aec941))
44
+ * style issue ([8694bf7](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/8694bf7e92c802166d85b1da3202f6713767ac7c))
45
+
46
+
47
+ ### Config
48
+
49
+ * updated core theme version ([6bf96c3](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/6bf96c35a1d720c19bf748e9b5ab82220f057b40))
50
+
51
+
52
+ * Merge branch 'tm-2565-matrix-contact-us' into 'master' ([917bfc1](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/917bfc1747da5a96e5b8e67db8eb43641b568ad8))
53
+ * Merge branch 'master' into tm-2565-matrix-contact-us ([a4a682f](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/a4a682fc9355a9f97c68196d8feaf235f6935fca))
54
+
55
+ ## [2.3.7](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v2.3.6...v2.3.7) (2021-11-22)
56
+
57
+
58
+ ### Bug Fixes
59
+
60
+ * correction to typo ([b50be3c](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/b50be3c5e42f2560f5850f6b9b8e624d56790fe0))
61
+ * force load lazy images on tab change ([fa06336](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/fa06336730891bed815cbf1867d4ca870d257fbb))
62
+ * general fixes ([5aef217](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/5aef217afd001c09c8baa51ce75dc087a28f8294))
63
+ * highlight search query on auto complete ([2aee5da](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/2aee5da1c4e5b4d790ee1a1c5a687f5f790d244b))
64
+
65
+
66
+ * Merge branch 'tm-2478-search' into 'master' ([a86ac37](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/a86ac379825d5599b066d9f13b081c8ff7b8f4b2))
67
+
1
68
  ## [2.3.6](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v2.3.5...v2.3.6) (2021-11-18)
2
69
 
3
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-matrix-theme",
3
- "version": "2.3.6",
3
+ "version": "3.0.1",
4
4
  "main": "index.js",
5
5
  "description": "Matrix Theme NPM Package",
6
6
  "author": "",
@@ -31,7 +31,7 @@
31
31
  "cross-env": "^7.0.2",
32
32
  "dotenv": "8.2.0",
33
33
  "gatsby": "^3.3.1",
34
- "gatsby-core-theme": "^1.6.3",
34
+ "gatsby-core-theme": "^1.6.8",
35
35
  "gatsby-image": "^3.3.0",
36
36
  "gatsby-plugin-image": "^1.3.1",
37
37
  "gatsby-plugin-postcss": "^4.3.0",
@@ -0,0 +1,44 @@
1
+ .authorCard {
2
+ width: 100%;
3
+ background: var(--color-2);
4
+ border-radius: var(--border-radius);
5
+ @include flex-direction(row);
6
+ padding: 1.6rem;
7
+ .img {
8
+ width: 6rem;
9
+ height: 6rem;
10
+ img {
11
+ width: 100%;
12
+ height: 100%;
13
+ border-radius: 50%;
14
+ }
15
+ }
16
+ .txt {
17
+ padding-left: 1.2rem;
18
+ height: 6rem;
19
+ @include flex-direction(column);
20
+ align-content: center;
21
+ justify-content: center;
22
+ div {
23
+ line-height: 1.8rem;
24
+ }
25
+ }
26
+ .name {
27
+ font-weight: 600;
28
+ font-size: 1.6rem;
29
+ color: var(--color-33);
30
+ line-height: 2.4rem;
31
+ }
32
+ .position {
33
+ font-weight: normal;
34
+ font-size: 1.2rem;
35
+ color: var(--color-32);
36
+ margin: 0.4rem 0 0 0;
37
+ }
38
+ .email {
39
+ font-weight: 600;
40
+ font-size: 1.2rem;
41
+ line-height: 1.8rem;
42
+ color:var(--color-51);
43
+ }
44
+ }
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ // eslint-disable-next-line import/no-extraneous-dependencies
3
+ import {
4
+ Title,
5
+ Description,
6
+ Primary,
7
+ PRIMARY_STORY,
8
+ ArgsTable,
9
+ } from '@storybook/addon-docs/blocks';
10
+ import { authors } from 'gatsby-core-theme/tests/factories/modules/contact-us-authors.factory';
11
+ import AuthorCard from '.';
12
+
13
+ const authorsKeys = Object.keys(authors);
14
+
15
+ export default {
16
+ title: 'Matrix-Theme/Atoms/Author Card',
17
+ component: AuthorCard,
18
+ argTypes: {
19
+ author: {
20
+ name: 'author',
21
+ type: { name: 'object', required: true },
22
+ defaultValue: '',
23
+ description: 'author object data',
24
+ },
25
+ },
26
+ parameters: {
27
+ docs: {
28
+ description: {
29
+ component: 'A component that displays authors cards',
30
+ },
31
+ page: () => (
32
+ <>
33
+ <Title />
34
+ <Description />
35
+ <Primary />
36
+ <ArgsTable story={PRIMARY_STORY} />
37
+ </>
38
+ ),
39
+ },
40
+ },
41
+ };
42
+
43
+ const Template = (args) => <AuthorCard {...args} />;
44
+ export const Default = Template.bind({});
45
+ Default.args = {
46
+ author: authors[authorsKeys[0]],
47
+ };
@@ -0,0 +1,29 @@
1
+ /* eslint-disable camelcase */
2
+ import React from 'react';
3
+ import { render, cleanup } from '@testing-library/react';
4
+ import { authors } from 'gatsby-core-theme/tests/factories/modules/contact-us-authors.factory';
5
+ import '@testing-library/jest-dom/extend-expect';
6
+ import AuthorCard from '.';
7
+
8
+ const authorsKeys = Object.keys(authors);
9
+
10
+ describe('AuthorCard Component', () => {
11
+ test('render one author', () => {
12
+ const { container } = render(<AuthorCard author={authors[authorsKeys[0]]} />);
13
+ const { name } = authors[authorsKeys[0]];
14
+ expect(container).toBeTruthy();
15
+ expect(container.querySelector('.name').innerHTML).toEqual(name);
16
+ });
17
+
18
+ test('render each author', () => {
19
+ Object.keys(authors).forEach((author) => {
20
+ const { name, email_address } = authors[author];
21
+ const { container } = render(<AuthorCard author={authors[author]} />);
22
+ expect(container.querySelector('.name').innerHTML).toEqual(name);
23
+ expect(container.querySelector('a').innerHTML).toEqual(email_address);
24
+ });
25
+ });
26
+ });
27
+ afterEach(() => {
28
+ cleanup();
29
+ });
@@ -0,0 +1,41 @@
1
+ /* eslint-disable camelcase */
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
5
+ import { imagePrettyUrl } from 'gatsby-core-theme/src/helpers/getters';
6
+ import styles from './author-card.module.scss';
7
+
8
+ const AuthorCard = ({ author }) => {
9
+ const { name, author_title, email_address, image } = author || {};
10
+
11
+ return (
12
+ <div className={styles.authorCard}>
13
+ <div className={styles.img}>
14
+ <LazyImage src={imagePrettyUrl(image)} alt={name} />
15
+ </div>
16
+ <div className={styles.txt}>
17
+ <div className={styles.name}>{name}</div>
18
+ <div className={styles.position}>{author_title}</div>
19
+ <a
20
+ className={styles.email}
21
+ href={`mailto:${email_address}`}
22
+ target="_blank"
23
+ rel="noreferrer"
24
+ >
25
+ {email_address}
26
+ </a>
27
+ </div>
28
+ </div>
29
+ );
30
+ };
31
+
32
+ AuthorCard.propTypes = {
33
+ author: PropTypes.shape({
34
+ name: PropTypes.string,
35
+ author_title: PropTypes.string,
36
+ email_address: PropTypes.string,
37
+ image: PropTypes.string,
38
+ }).isRequired,
39
+ };
40
+
41
+ export default AuthorCard;
@@ -32,7 +32,7 @@ const ArticleCard = ({ item }) => {
32
32
  <BaseCard item={item} cardType="article">
33
33
  {!featured && (
34
34
  <div className={styles.cardBanner}>
35
- <Link to={path} className="article-card-gtm">
35
+ <Link to={path} className="article-card-gtm" aria-label={`${title} Link`}>
36
36
  {banner ? (
37
37
  <LazyImage src={imagePrettyUrl(banner)} alt={title} />
38
38
  ) : (
@@ -25,7 +25,7 @@ const GameCard = ({ item, button_text = 'play_now' }) => {
25
25
  <BaseCard item={item} isLinked cardType="game">
26
26
  {!featured && (
27
27
  <div className={styles.cardBanner}>
28
- <Link to={path} className="game-card-gtm">
28
+ <Link to={path} className="game-card-gtm" aria-label={`${title} Link`}>
29
29
  <LazyImage src={imagePrettyUrl(banner)} alt={title} />
30
30
  </Link>
31
31
  </div>
@@ -3,22 +3,20 @@ import React, { useContext } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { FaStar } from 'react-icons/fa';
5
5
  import StarRating from 'gatsby-core-theme/src/components/molecules/star-rating';
6
- import { imagePrettyUrl, prettyTracker, translate } from 'gatsby-core-theme/src/helpers/getters';
7
- import Button from 'gatsby-core-theme/src/components/atoms/button';
6
+ import { imagePrettyUrl, translate } from 'gatsby-core-theme/src/helpers/getters';
8
7
  import Link from 'gatsby-core-theme/src/hooks/link';
9
8
  import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
10
9
  import Bonus from 'gatsby-core-theme/src/components/atoms/bonus';
11
10
  import Tnc from 'gatsby-core-theme/src/components/molecules/tnc';
12
11
  import { Context } from 'gatsby-core-theme/src/context/TranslationsProvider';
12
+ import OperatorCta from 'gatsby-core-theme/src/components/atoms/operator-cta';
13
13
  import BaseCard from '../base-card';
14
14
  import styles from './operator-card.module.scss';
15
15
 
16
16
  const OperatorCard = ({ item, featured = false, number }) => {
17
17
  const { relation, path } = item;
18
- const prettyLink = prettyTracker(relation);
19
18
  const reviewPath = path || relation.path;
20
19
  const status = relation?.status;
21
- const isActive = status === 'active';
22
20
  const isInactive = status === 'inactive';
23
21
  const backgroundImage = number === 1 ? 'featuredCasino' : null;
24
22
  const { translations } = useContext(Context) || {};
@@ -71,15 +69,12 @@ const OperatorCard = ({ item, featured = false, number }) => {
71
69
  </Link>
72
70
  </div>
73
71
  <div className={`${styles.cardButtons}`}>
74
- {isActive && (
75
- <Button
76
- to={prettyLink}
77
- btnText={translate(translations, 'play_now', 'Sign Up')}
78
- isInternalLink={false}
79
- disabled={!isActive}
80
- gtmClass="operator-card-gtm btn-cta"
81
- />
82
- )}
72
+ <OperatorCta
73
+ tracker="main"
74
+ operator={relation}
75
+ playText={translate(translations, 'play_now', 'Play Now')}
76
+ gtmClass="operator-card-gtm btn-cta"
77
+ />
83
78
  </div>
84
79
  {relation?.extra_fields?.terms_and_conditions_text_enabled === '1' && (
85
80
  <div className={styles.tnc}>
@@ -17,7 +17,11 @@ const PaymentMethodCard = ({ item, showTitle = true, showDesc = true }) => {
17
17
  <BaseCard item={item} cardType="payment_method">
18
18
  <div className={styles.content}>
19
19
  <div className={styles.header}>
20
- <Link className={`${styles.links} payment-method-card-gtm`} to={path}>
20
+ <Link
21
+ className={`${styles.links} payment-method-card-gtm`}
22
+ aria-label={`${title} Link`}
23
+ to={path}
24
+ >
21
25
  <LazyImage className={styles.logo} src={imagePrettyUrl(relation?.logo)} />
22
26
  </Link>
23
27
  {showTitle && (
@@ -26,7 +26,11 @@ const SoftwareProviderCard = ({
26
26
  <BaseCard item={item} cardType="software_provider">
27
27
  <div className={styles.content}>
28
28
  <div className={styles.header}>
29
- <Link className={`${styles.links} software-provider-card-gtm`} to={path}>
29
+ <Link
30
+ className={`${styles.links} software-provider-card-gtm`}
31
+ aria-label={`${title} Link`}
32
+ to={path}
33
+ >
30
34
  <LazyImage className={styles.logo} src={imagePrettyUrl(relation?.logo)} />
31
35
  </Link>
32
36
  {showTitle && (
@@ -1,11 +1,17 @@
1
+ /* eslint-disable react/no-danger */
1
2
  import React from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import { GrFormNext } from 'react-icons/gr';
4
5
  import Link from 'gatsby-core-theme/src/hooks/link';
6
+ import { splitSearchQuery } from '../../../../helpers/splitSearchQuery';
5
7
 
6
- const Article = ({ item = {}, Button = <GrFormNext /> }) => (
8
+ const Article = ({ item = {}, Button = <GrFormNext />, searchQuery }) => (
7
9
  <Link to={item.path} className="article-gtm">
8
- <h1>{item.title}</h1>
10
+ <h1
11
+ dangerouslySetInnerHTML={{
12
+ __html: splitSearchQuery(item.title, searchQuery),
13
+ }}
14
+ />
9
15
  {Button}
10
16
  </Link>
11
17
  );
@@ -15,6 +21,7 @@ Article.propTypes = {
15
21
  title: PropTypes.string,
16
22
  }).isRequired,
17
23
  Button: PropTypes.func,
24
+ searchQuery: PropTypes.string,
18
25
  };
19
26
 
20
27
  export default Article;
@@ -1,11 +1,17 @@
1
+ /* eslint-disable react/no-danger */
1
2
  import React from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import { GrFormNext } from 'react-icons/gr';
4
5
  import Link from 'gatsby-core-theme/src/hooks/link';
6
+ import { splitSearchQuery } from '../../../../helpers/splitSearchQuery';
5
7
 
6
- const Game = ({ item = {}, Button = <GrFormNext /> }) => (
8
+ const Game = ({ item = {}, Button = <GrFormNext />, searchQuery }) => (
7
9
  <Link to={item.path} className="game-gtm">
8
- <h1>{item.title}</h1>
10
+ <h1
11
+ dangerouslySetInnerHTML={{
12
+ __html: splitSearchQuery(item.title, searchQuery),
13
+ }}
14
+ />
9
15
  {Button}
10
16
  </Link>
11
17
  );
@@ -15,6 +21,7 @@ Game.propTypes = {
15
21
  title: PropTypes.string,
16
22
  }).isRequired,
17
23
  Button: PropTypes.func,
24
+ searchQuery: PropTypes.string,
18
25
  };
19
26
 
20
27
  export default Game;
@@ -1,11 +1,17 @@
1
+ /* eslint-disable react/no-danger */
1
2
  import React from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import { GrFormNext } from 'react-icons/gr';
4
5
  import Link from 'gatsby-core-theme/src/hooks/link';
6
+ import { splitSearchQuery } from '../../../../helpers/splitSearchQuery';
5
7
 
6
- const Operator = ({ item = {}, Button = <GrFormNext /> }) => (
8
+ const Operator = ({ item = {}, Button = <GrFormNext />, searchQuery }) => (
7
9
  <Link to={`/${item.path}`} className="operator-gtm">
8
- <h1>{item.title}</h1>
10
+ <h1
11
+ dangerouslySetInnerHTML={{
12
+ __html: splitSearchQuery(item.title, searchQuery),
13
+ }}
14
+ />
9
15
  {Button}
10
16
  </Link>
11
17
  );
@@ -16,6 +22,7 @@ Operator.propTypes = {
16
22
  path: PropTypes.string,
17
23
  }).isRequired,
18
24
  Button: PropTypes.func,
25
+ searchQuery: PropTypes.string,
19
26
  };
20
27
 
21
28
  export default Operator;
@@ -1,11 +1,17 @@
1
+ /* eslint-disable react/no-danger */
1
2
  import React from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import { GrFormNext } from 'react-icons/gr';
4
5
  import Link from 'gatsby-core-theme/src/hooks/link';
6
+ import { splitSearchQuery } from '../../../../helpers/splitSearchQuery';
5
7
 
6
- const PaymentMethods = ({ item = {}, Button = <GrFormNext /> }) => (
8
+ const PaymentMethods = ({ item = {}, Button = <GrFormNext />, searchQuery }) => (
7
9
  <Link to={item.path} className="payment-method-gtm">
8
- <h1>{item.title}</h1>
10
+ <h1
11
+ dangerouslySetInnerHTML={{
12
+ __html: splitSearchQuery(item.title, searchQuery),
13
+ }}
14
+ />
9
15
  {Button}
10
16
  </Link>
11
17
  );
@@ -15,6 +21,7 @@ PaymentMethods.propTypes = {
15
21
  title: PropTypes.string,
16
22
  }).isRequired,
17
23
  Button: PropTypes.func,
24
+ searchQuery: PropTypes.string,
18
25
  };
19
26
 
20
27
  export default PaymentMethods;
@@ -1,11 +1,17 @@
1
+ /* eslint-disable react/no-danger */
1
2
  import React from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import { GrFormNext } from 'react-icons/gr';
4
5
  import Link from 'gatsby-core-theme/src/hooks/link';
6
+ import { splitSearchQuery } from '../../../../helpers/splitSearchQuery';
5
7
 
6
- const SoftwareProvider = ({ item = {}, Button = <GrFormNext /> }) => (
8
+ const SoftwareProvider = ({ item = {}, Button = <GrFormNext />, searchQuery }) => (
7
9
  <Link to={item.path} className="software-provider-gtm">
8
- <h1>{item.title}</h1>
10
+ <h1
11
+ dangerouslySetInnerHTML={{
12
+ __html: splitSearchQuery(item.title, searchQuery),
13
+ }}
14
+ />
9
15
  {Button}
10
16
  </Link>
11
17
  );
@@ -15,6 +21,7 @@ SoftwareProvider.propTypes = {
15
21
  title: PropTypes.string,
16
22
  }).isRequired,
17
23
  Button: PropTypes.func,
24
+ searchQuery: PropTypes.string,
18
25
  };
19
26
 
20
27
  export default SoftwareProvider;
@@ -0,0 +1,56 @@
1
+ import React, { useContext } from 'react';
2
+ import { FaInstagram, FaFacebookSquare, FaTwitter, FaLinkedin, FaYoutube } from 'react-icons/fa';
3
+ import PropTypes from 'prop-types';
4
+ import keygen from 'gatsby-core-theme/src/helpers/keygen';
5
+ import { Context } from 'gatsby-core-theme/src/context/TranslationsProvider';
6
+ import { translate } from '~helpers/getters';
7
+ import styles from './social-icons.module.scss';
8
+
9
+ const SocialIcons = ({ socialIcons }) => {
10
+ const { translations } = useContext(Context) || {};
11
+ const keys = Object.keys(socialIcons);
12
+ const switchIcons = (icons) => {
13
+ switch (icons) {
14
+ case 'instagram':
15
+ return <FaInstagram />;
16
+ case 'facebook':
17
+ return <FaFacebookSquare />;
18
+ case 'twitter':
19
+ return <FaTwitter />;
20
+ case 'linkedin':
21
+ return <FaLinkedin />;
22
+ case 'youtube':
23
+ return <FaYoutube />;
24
+ default:
25
+ return null;
26
+ }
27
+ };
28
+
29
+ return (
30
+ <div className={styles.container}>
31
+ <div className={styles.title}>{translate(translations, 'follow_us', 'Follow Us')}</div>
32
+ <div className={styles.socialIcons}>
33
+ {keys.map(
34
+ (key) =>
35
+ socialIcons[key] && (
36
+ <a
37
+ key={keygen()}
38
+ aria-label={`${key} Link`}
39
+ href={socialIcons[key]}
40
+ target="_blank"
41
+ rel="noreferrer"
42
+ >
43
+ {switchIcons(key)}
44
+ </a>
45
+ )
46
+ )}
47
+ </div>
48
+ </div>
49
+ );
50
+ };
51
+
52
+ export default SocialIcons;
53
+
54
+ SocialIcons.propTypes = {
55
+ socialIcons: PropTypes.shape({}),
56
+ };
@@ -0,0 +1,33 @@
1
+ .container {
2
+ width: 100%;
3
+ @include flex-direction(column);
4
+ .title{
5
+ padding-bottom: 1.6rem;
6
+ font-weight: 600;
7
+ font-size: 1.6rem;
8
+ line-height: 2.4rem;
9
+ color: var(--color-33);
10
+ @include min(tablet){
11
+ font-weight: bold;
12
+ font-size: 3.6rem;
13
+ line-height: 4.6rem;
14
+ }
15
+ }
16
+ .socialIcons{
17
+ display: inline-flex;
18
+ a {
19
+ display: inline-block;
20
+ width: 4rem;
21
+ height: 4rem;
22
+ line-height: 4.7rem;
23
+ border-radius: 50%;
24
+ background: var(--color-52);
25
+ margin: 0 1.6rem 0 0;
26
+ text-align: center;
27
+ font-size: 2rem;
28
+ svg{
29
+ color: var(--color-16);
30
+ }
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,55 @@
1
+ import React from 'react';
2
+ // eslint-disable-next-line import/no-extraneous-dependencies
3
+ import {
4
+ Title,
5
+ Description,
6
+ Primary,
7
+ PRIMARY_STORY,
8
+ ArgsTable,
9
+ } from '@storybook/addon-docs/blocks';
10
+ import { siteSchema } from 'gatsby-core-theme/tests/factories/modules/site-schema.factory';
11
+ import SocialIcons from '.';
12
+
13
+ const socialIcons =
14
+ siteSchema &&
15
+ (({ instagram, facebook, twitter, linkedin, youtube }) => ({
16
+ instagram,
17
+ facebook,
18
+ twitter,
19
+ linkedin,
20
+ youtube,
21
+ }))(siteSchema);
22
+
23
+ export default {
24
+ title: 'Matrix-Theme/Atoms/Social Icons',
25
+ component: SocialIcons,
26
+ argTypes: {
27
+ socialIcons: {
28
+ name: 'social icons',
29
+ type: { name: 'object', required: true },
30
+ defaultValue: '',
31
+ description: 'social icons object data',
32
+ },
33
+ },
34
+ parameters: {
35
+ docs: {
36
+ description: {
37
+ component: 'A component that displays social icons',
38
+ },
39
+ page: () => (
40
+ <>
41
+ <Title />
42
+ <Description />
43
+ <Primary />
44
+ <ArgsTable story={PRIMARY_STORY} />
45
+ </>
46
+ ),
47
+ },
48
+ },
49
+ };
50
+
51
+ const Template = (args) => <SocialIcons {...args} />;
52
+ export const Default = Template.bind({});
53
+ Default.args = {
54
+ socialIcons,
55
+ };
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { render, cleanup } from '@testing-library/react';
3
+ import '@testing-library/jest-dom';
4
+ import { siteSchema } from 'gatsby-core-theme/tests/factories/modules/site-schema.factory';
5
+ import SocialIcons from '.';
6
+
7
+ const socialIcons =
8
+ siteSchema &&
9
+ (({ instagram, facebook, twitter, linkedin, youtube }) => ({
10
+ instagram,
11
+ facebook,
12
+ twitter,
13
+ linkedin,
14
+ youtube,
15
+ }))(siteSchema);
16
+
17
+ const socialIconsLength = Object.keys(socialIcons);
18
+
19
+ describe('SocialIcons Component', () => {
20
+ test('render with props and social icons list', () => {
21
+ const { container } = render(<SocialIcons socialIcons={socialIcons} />);
22
+ expect(container).toBeTruthy();
23
+ const socialLinksWrapper = container.querySelector('.socialIcons');
24
+ expect(socialLinksWrapper.querySelectorAll('a')).toHaveLength(socialIconsLength.length);
25
+ expect(socialLinksWrapper.querySelectorAll('a')[2].innerText).toEqual(siteSchema[2]);
26
+ expect(socialLinksWrapper.querySelectorAll('a')[4].innerText).toEqual(siteSchema[4]);
27
+ });
28
+ });
29
+ afterEach(() => {
30
+ cleanup();
31
+ });