gatsby-matrix-theme 10.0.13 → 11.0.0

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 (40) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/package.json +1 -1
  3. package/src/components/atoms/cards/operators-table/index.js +13 -10
  4. package/src/components/atoms/ratings/index.js +54 -0
  5. package/src/components/atoms/ratings/ratings.module.scss +59 -0
  6. package/src/components/atoms/ratings/ratings.stories.js +25 -0
  7. package/src/components/atoms/ratings/ratings.test.js +38 -0
  8. package/src/components/atoms/tooltip/tooltip.test.js +4 -0
  9. package/src/components/molecules/header/variants/default/template-one/index.js +59 -0
  10. package/src/components/molecules/header/variants/default/template-one/template-one.module.scss +67 -0
  11. package/src/components/molecules/header/variants/default/template-one/template-one.stories.js +86 -0
  12. package/src/components/molecules/header/variants/default/template-one/template-one.test.js +80 -0
  13. package/src/components/molecules/header/variants/default/template-two/index.js +83 -0
  14. package/src/components/molecules/header/variants/default/template-two/template-two.module.scss +169 -0
  15. package/src/components/molecules/header/variants/default/template-two/template-two.stories.js +73 -0
  16. package/src/components/molecules/header/variants/default/template-two/template-two.test.js +94 -0
  17. package/src/components/molecules/header/variants/slot/template-one/index.js +86 -0
  18. package/src/components/molecules/header/variants/slot/template-one/slot.module.scss +114 -0
  19. package/src/components/molecules/header/variants/slot/template-one/template-one.stories.js +26 -0
  20. package/src/components/molecules/header/variants/slot/template-one/templateone.test.js +48 -0
  21. package/src/components/molecules/newsletter/index.js +2 -0
  22. package/src/gatsby-core-theme/components/molecules/header/header.module.scss +31 -38
  23. package/src/gatsby-core-theme/components/molecules/header/header.test.js +10 -17
  24. package/src/gatsby-core-theme/components/molecules/header/index.js +79 -28
  25. package/src/gatsby-core-theme/components/organisms/toplist/list/index.js +1 -1
  26. package/src/gatsby-core-theme/components/organisms/toplist/list/list.test.js +1 -0
  27. package/src/gatsby-core-theme/styles/utils/variables/_main.scss +2 -0
  28. package/storybook/public/64.680a16cc.iframe.bundle.js +1 -0
  29. package/storybook/public/{455.4a66b118.iframe.bundle.js → 666.d58e0250.iframe.bundle.js} +4 -4
  30. package/storybook/public/{455.4a66b118.iframe.bundle.js.LICENSE.txt → 666.d58e0250.iframe.bundle.js.LICENSE.txt} +0 -0
  31. package/storybook/public/{455.4a66b118.iframe.bundle.js.map → 666.d58e0250.iframe.bundle.js.map} +1 -1
  32. package/storybook/public/iframe.html +1 -1
  33. package/storybook/public/main.67ced4cc.iframe.bundle.js +1 -0
  34. package/storybook/public/{runtime~main.66d840c7.iframe.bundle.js → runtime~main.bc027a21.iframe.bundle.js} +1 -1
  35. package/test/factories/pages/slot.js +59 -0
  36. package/tests/envVars.js +1 -0
  37. package/tests/factories/pages/default.factory.js +90 -0
  38. package/src/components/molecules/header/variants/slot/index.js +0 -12
  39. package/storybook/public/64.4e0c1a5c.iframe.bundle.js +0 -1
  40. package/storybook/public/main.eadbf337.iframe.bundle.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,73 @@
1
+ # [11.0.0](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v10.0.14...v11.0.0) (2023-01-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add max width for slots ([0d6f830](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/0d6f830c3abdabf1e657c3cc491034533390857e))
7
+ * add padding to slotheader ([8b28ce6](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/8b28ce6e18be246c8db471afe4efb903a12b308a))
8
+ * add template one for slot/gaming ([e849f5e](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e849f5ea685aa3d993a082256d6f9fd222d5e69f))
9
+ * added translations ([9f2c5e7](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/9f2c5e7d020dc54da27122ee9e726f379a6ce305))
10
+ * change svg and its size ([c134993](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/c134993a0ebbb3203c87483fcae13023f7c1b85b))
11
+ * clean up header section ([6cce914](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/6cce914c78bdeb3a7bbdf30bfdd06a8ac65ca87d))
12
+ * remove typo ([10f94eb](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/10f94eb0db5eaab58bffaab6d4a2867f7858b640))
13
+ * show in the toplist just operator that has active status ([4d677bc](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/4d677bc038cae31279822a6edfdfed309cc99d84))
14
+ * storybook folder structure names ([9a251dd](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/9a251dd913bf90e4737289fa4e12b6ad0ad61cab))
15
+ * storybook structure and default colour ([96cb803](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/96cb803654daed0e413885e981c2d6e6ff806d0e))
16
+ * test coverage ([9859301](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/98593019552600fc990c645e291f41aa92104800))
17
+ * typo issue on header module ([ebfe10b](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/ebfe10b24e5db55deaf7da0651214fa3be3f4704))
18
+ * update changes and add story book and tests ([c8e522e](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/c8e522e559ccabe2af97643da96c53a87a78327a))
19
+ * update header component scss ([095eba0](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/095eba06dab2f22b8a1a1902a3e576c89484b466))
20
+ * update name storybook ([5093cd5](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/5093cd5cd1e4f5b3089146a86a8a9d0d98e8da21))
21
+ * update tests, removed console.logs and updated styling for ratings ([44aaa62](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/44aaa62425542896bc097a58725912c4c85059b1))
22
+ * updated project based on the requirements ([089dbad](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/089dbad6f50409d3e67a2dae18f70b8a99332ccf))
23
+
24
+
25
+ ### Code Refactoring
26
+
27
+ * add css vars for tem two bg colour ([4053130](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/4053130a999d1a5205a81dcc63c9a9e3730a7465))
28
+ * add temp featured image ([7eaa990](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/7eaa990e3bbebf6d86fb447242a670e2f645ae6a))
29
+ * add template based classes ([2737131](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/27371317510577af1cb85bcf7cdde79dda3a1c19))
30
+ * add two templates for default headers ([ed070cd](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/ed070cd367bcf03fb43960addc4cd04becf6daca))
31
+ * change dummy link ([a96fca2](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/a96fca2578ea4583abbd2ca4ba70e5f16b6a48f0))
32
+ * change of scss ordering ([8794dbf](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/8794dbf70865170a43f5a3d2138c25f32524571b))
33
+ * changes to field types ([eabc3e8](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/eabc3e893cb5fdee4d7987363d9869478753f8ff))
34
+ * correction to page type for default pages ([cd8aa25](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/cd8aa25141edfc9200057fa3b3bec9167e12c9b1))
35
+ * corrections to code review and remove images ([e4d3137](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e4d31370853cbdd2cb1bb0dd3977de2bb64ec934))
36
+ * fix for undefined classnames ([60306e9](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/60306e9631deceb3f061aafbfef4155e13ba2d98))
37
+ * fix mobile styles ([907f341](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/907f3419a3744a98cbd46c057e93a77699537e30))
38
+ * fix storybook properties and tests ([79f9858](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/79f9858581b60f70e24d72e5b65233f7bf146517))
39
+ * fix template one minor css issues ([5829ca2](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/5829ca2ab33899f0c4f9c03f7b14dc0ce60f63cb))
40
+ * image dimensions ([f8cc38e](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/f8cc38e2f64b9fd6169fb04db20a6d637386b038))
41
+ * restructure header component ([7747c9d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/7747c9da6e0b4d5f791ef191cb4bdf6785ada743))
42
+ * separate css ([7451e98](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/7451e985b926e2c1d1f7a39acead52e7e3eeb019))
43
+ * storybook images ([fff47ea](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/fff47ea3a6594143cbed2a6699f93917610285af))
44
+ * storybook layout change ([4add525](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/4add525d95ae847dc0c995b0368518702f29e14f))
45
+
46
+
47
+ * Merge branch 'tm-3113-toplist' into 'master' ([8238beb](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/8238beba9fd95d9adbc2d1295d1562573c06f239))
48
+ * Merge branch 'tm-3254-game-header' into 'master' ([b4d0d81](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/b4d0d818fd80df7f95b0885917f5b5d9d2afadc4))
49
+ * Merge branch 'master' into 'tm-3254-game-header' ([b2f96c6](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/b2f96c666e5288f63a7f1c736da379bd123d7a4a))
50
+ * Merge branch 'tm-3252-default-headers' into 'master' ([9c313bd](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/9c313bd53a7f34173e555712833444d3646ccb4e))
51
+ * Merge branch 'master' into tm-3252-default-headers ([d9ea393](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/d9ea393cd598a2fe0a79d29b0b95341e6bc9f828))
52
+ * Merge branch 'master' into tm-3252-default-headers ([2c2960a](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/2c2960a1f3791b4742b8ac6e71c78ca8d27d60d3))
53
+ * Merge branch 'master' into tm-3252-default-headers ([30bdf57](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/30bdf577ac44e4229561297d54e153832c2ae0f2))
54
+ * Merge branch 'master' into tm-3252-default-headers ([9aebd17](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/9aebd1771db338a99675ef3491e1577b145d8896))
55
+ * Merge branch 'master' into tm-3252-default-headers ([21582c7](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/21582c7cbcfe08335b1ff45fd55265c1b5585cc5))
56
+
57
+
58
+ ### Tests
59
+
60
+ * fix test ([5076a8c](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/5076a8c42acfd194701d7e176b536f24312b4e1d))
61
+ * fix test scripts ([32ffbee](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/32ffbee13e6e421d9b7a9d8e1465d03a14c0f990))
62
+
63
+ ## [10.0.14](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v10.0.13...v10.0.14) (2023-01-17)
64
+
65
+
66
+ ### Bug Fixes
67
+
68
+ * form ([fbbda88](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/fbbda8881a2ce94692807cef5c576199f60a5cf5))
69
+ * operator cards table ([f7f9055](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/f7f9055751386b0bcf91e6d79cf0268d09e433e9))
70
+
1
71
  ## [10.0.13](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v10.0.12...v10.0.13) (2023-01-17)
2
72
 
3
73
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-matrix-theme",
3
- "version": "10.0.13",
3
+ "version": "11.0.0",
4
4
  "main": "index.js",
5
5
  "description": "Matrix Theme NPM Package",
6
6
  "author": "",
@@ -13,16 +13,19 @@ const CasinosTable = ({ module, page }) => {
13
13
  const { items } = module || {};
14
14
 
15
15
  const oneLiner = ({ one_liner }) => {
16
- const [firstLine, secondLine] = one_liner.split('+');
17
- return (
18
- <>
19
- <span className={styles.firstLine}>
20
- {firstLine}
21
- <br />
22
- </span>
23
- {secondLine && <span className={styles.secondLine}>{`+${secondLine}`}</span>}
24
- </>
25
- );
16
+ if (one_liner) {
17
+ const [firstLine, secondLine] = one_liner.split('+');
18
+ return (
19
+ <>
20
+ <span className={styles.firstLine}>
21
+ {firstLine}
22
+ <br />
23
+ </span>
24
+ {secondLine && <span className={styles.secondLine}>{`+${secondLine}`}</span>}
25
+ </>
26
+ );
27
+ }
28
+ return <></>;
26
29
  };
27
30
 
28
31
  return (
@@ -0,0 +1,54 @@
1
+ import React, { useContext } from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ import { FaStar } from '@react-icons/all-files/fa/FaStar';
5
+ import { translate } from 'gatsby-core-theme/src/helpers/getters';
6
+ import { Context } from 'gatsby-core-theme/src/context/MainProvider';
7
+ import styles from './ratings.module.scss';
8
+
9
+ const Ratings = ({ averageRating, ratings, relation }) => {
10
+ const { translations } = useContext(Context) || {};
11
+ const votalityValue = relation?.volatility ? relation?.volatility : 0;
12
+ const rangeText = { 0: 'Low', 1: 'Medium', 2: 'High' }[votalityValue] || '0%';
13
+
14
+ return (
15
+ <ul className={styles.ratings}>
16
+ <li key="Overall">
17
+ <p>{translate(translations, 'overall', 'Overall')}</p>
18
+ <div>
19
+ <FaStar />
20
+ <p data-testid="overall-rating">{averageRating}</p>
21
+ <p>/5</p>
22
+ </div>
23
+ </li>
24
+ {ratings?.map((rating) => (
25
+ <li key={rating[rating?.field_name]}>
26
+ <p>{rating?.field_label}</p>
27
+ {rating?.field_name === 'rtp' ? (
28
+ <p>{relation[rating?.field_name]}%</p>
29
+ ) : (
30
+ <div>
31
+ <FaStar />
32
+ <p>{relation[rating?.field_name]}</p>
33
+ <p>/5</p>
34
+ </div>
35
+ )}
36
+ </li>
37
+ ))}
38
+ <li>
39
+ <p>{translate(translations, 'volatility', 'Volatility')}</p>
40
+ <div className={styles.bar}>{rangeText}</div>
41
+ </li>
42
+ </ul>
43
+ );
44
+ };
45
+
46
+ Ratings.propTypes = {
47
+ averageRating: PropTypes.string,
48
+ // eslint-disable-next-line react/forbid-prop-types
49
+ ratings: PropTypes.array,
50
+ relation: PropTypes.shape({
51
+ volatility: PropTypes.string,
52
+ }),
53
+ };
54
+ export default Ratings;
@@ -0,0 +1,59 @@
1
+ .ratings {
2
+ display: flex;
3
+ margin: 0rem;
4
+ height: 100%;
5
+ gap: 0.8rem;
6
+ overflow-x: scroll;
7
+ @include min(tablet) {
8
+ overflow: hidden;
9
+ gap: 1.6rem;
10
+ > :first-child {
11
+ display: none;
12
+ }
13
+ }
14
+ > li,
15
+ > div {
16
+ margin-bottom: inherit;
17
+ width: 100%;
18
+ background: #fbfbfb;
19
+ padding: 16px 8px;
20
+ min-width: 12.2rem;
21
+ box-shadow: 4px 4px 30px rgb(0 0 0 / 3%);
22
+ font-weight: bold;
23
+ font-size: 1.4rem;
24
+ border-radius: 8px;
25
+ border: 1px solid #e9e9e9;
26
+ @include flex-direction(column);
27
+ @include flex-align(center, center);
28
+ color: #1c1a28;
29
+ > p {
30
+ font-weight: 700;
31
+ font-size: 14px;
32
+ line-height: 22px;
33
+ color: #1c1a28;
34
+ margin-bottom: 8px;
35
+ }
36
+ > div {
37
+ display: flex;
38
+ align-items: center;
39
+ > svg {
40
+ color: #ffdb20;
41
+ height: 1.8rem;
42
+ width: 1.8rem;
43
+ margin-right: 6px;
44
+ }
45
+ > p {
46
+ color: #1c1a28;
47
+ font-weight: 800;
48
+ font-size: 18px;
49
+ line-height: 28px;
50
+ }
51
+ @include max(mobile) {
52
+ > :last-child {
53
+ font-size: 1.6rem;
54
+ line-height: 2.7rem;
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,25 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ import React from 'react';
3
+ import Ratings from '.';
4
+
5
+ export default {
6
+ title: 'Matrix-Theme/Atoms/Ratings',
7
+ component: Ratings,
8
+ };
9
+
10
+ const Template = (args) => <Ratings {...args} />;
11
+
12
+ export const Default = Template.bind({});
13
+ Default.args = {
14
+ averageRating: 3,
15
+ ratings: [
16
+ { field_name: 'first_rating', field_label: 'Graphics' },
17
+ { field_name: 'third_rating', field_label: 'Bonuses' },
18
+ { field_name: 'rtp', field_label: 'RTP' },
19
+ ],
20
+ relation: {
21
+ first_rating: 2,
22
+ third_rating: 3,
23
+ rtp: 50,
24
+ },
25
+ };
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import { render, cleanup } from '@testing-library/react';
3
+ import '@testing-library/jest-dom/extend-expect';
4
+
5
+ import getPageData from '../../../../test/factories/pages/slot';
6
+ import Ratings from '.';
7
+
8
+ describe('summary component', () => {
9
+ test('render', () => {
10
+ const { container } = render(<Ratings page={getPageData()} />);
11
+ expect(container).toBeTruthy();
12
+
13
+ // Description
14
+ expect(container.querySelectorAll('ul.ratings')).toHaveLength(1);
15
+ });
16
+
17
+ test('renders the correct ratings', () => {
18
+ const averageRating = 4.5;
19
+ const ratings = [
20
+ { field_label: 'Graphics', field_name: 'graphics', value: 4.2 },
21
+ { field_label: 'Sound', field_name: 'sound', value: 5 },
22
+ ];
23
+ const relation = { graphics: 4.2, sound: 5 };
24
+ const { getByText, getByTestId } = render(
25
+ <Ratings averageRating={averageRating} ratings={ratings} relation={relation} />
26
+ );
27
+ const overallRating = getByTestId('overall-rating');
28
+ const graphicsRating = getByText(`${relation.graphics}`);
29
+ const soundRating = getByText(`${relation.sound}`);
30
+ expect(overallRating).toBeInTheDocument();
31
+ expect(graphicsRating).toBeInTheDocument();
32
+ expect(soundRating).toBeInTheDocument();
33
+ });
34
+ });
35
+
36
+ afterEach(() => {
37
+ cleanup();
38
+ });
@@ -16,5 +16,9 @@ describe('Tooltip Component', () => {
16
16
 
17
17
  fireEvent.mouseEnter(screen.getByText('Test Children'));
18
18
  await waitFor(() => screen.getByText('test content'));
19
+
20
+ fireEvent.mouseLeave(screen.getByText('Test Children'));
21
+ const isVisible = container.querySelector('.tooltip');
22
+ expect(isVisible).toBeFalsy();
19
23
  });
20
24
  });
@@ -0,0 +1,59 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { FaArrowRight } from '@react-icons/all-files/fa/FaArrowRight';
4
+ import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
5
+ import Button from 'gatsby-core-theme/src/components/atoms/button';
6
+ import { imagePrettyUrl, getAltText, getExtraField } from 'gatsby-core-theme/src/helpers/getters';
7
+ import styles from './template-one.module.scss';
8
+
9
+ export default function TemplateOne({ title, description, extraFields, imageObj }) {
10
+ const link = getExtraField(extraFields, 'link');
11
+
12
+ return (
13
+ <div className={styles.templateOne}>
14
+ <div className={styles.headerContainer}>
15
+ <h1>{title}</h1>
16
+ <div
17
+ // eslint-disable-next-line react/no-danger
18
+ dangerouslySetInnerHTML={{ __html: description }}
19
+ className={styles.description}
20
+ />
21
+ {link && (
22
+ <Button
23
+ to={link}
24
+ primaryColor={false}
25
+ btnText={link}
26
+ invertColors
27
+ gtmClass="default-header-template-one-gtm btn-cta"
28
+ icon={<FaArrowRight />}
29
+ />
30
+ )}
31
+ </div>
32
+ {imageObj && (
33
+ <LazyImage
34
+ src={imagePrettyUrl(imageObj.filename, imageObj.width, imageObj.height)}
35
+ alt={getAltText(imageObj, imageObj.title)}
36
+ width={imageObj.width}
37
+ height={imageObj.height}
38
+ loading="eager"
39
+ className={styles.image}
40
+ />
41
+ )}
42
+ </div>
43
+ );
44
+ }
45
+
46
+ TemplateOne.propTypes = {
47
+ title: PropTypes.string,
48
+ description: PropTypes.string,
49
+ imageObj: PropTypes.shape({
50
+ alt: PropTypes.string,
51
+ width: PropTypes.string,
52
+ height: PropTypes.string,
53
+ filename: PropTypes.string,
54
+ title: PropTypes.string,
55
+ }),
56
+ extraFields: PropTypes.shape({
57
+ link: PropTypes.string,
58
+ }),
59
+ };
@@ -0,0 +1,67 @@
1
+ .templateOne {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: space-between;
5
+ flex-direction: column-reverse;
6
+ gap: 2.4rem;
7
+ padding: 0 1.6rem;
8
+ max-width: var(--main-container-max);
9
+ margin: 0 auto;
10
+
11
+ @include min(tablet) {
12
+ flex-direction: row;
13
+ gap: 5rem;
14
+ }
15
+
16
+ @include min(desktop) {
17
+ gap: 15.2rem;
18
+ }
19
+ }
20
+
21
+ .image {
22
+ border-radius: 1.6rem;
23
+
24
+ @include min(tablet) {
25
+ max-width: 50%;
26
+ }
27
+
28
+ @include min(laptop) {
29
+ min-width: 35.6rem;
30
+ max-width: 35.6rem;
31
+ }
32
+ }
33
+
34
+ .headerContainer {
35
+ display: flex;
36
+ align-items: flex-start;
37
+ justify-content: center;
38
+ flex-direction: column;
39
+
40
+ h1 {
41
+ font-weight: 700;
42
+ font-size: 2.8rem;
43
+ line-height: 3.8rem;
44
+ text-transform: capitalize;
45
+ color: #1c1a28;
46
+ margin: 0 0 2.4rem;
47
+
48
+ @include min(tablet) {
49
+ font-size: 3.2rem;
50
+ line-height: 4.2rem;
51
+ }
52
+ }
53
+
54
+ a {
55
+ display: flex !important;
56
+ gap: 1.1rem;
57
+ }
58
+ }
59
+
60
+ .description {
61
+ font-weight: 500;
62
+ font-size: 1.6rem;
63
+ line-height: 2.7rem;
64
+ text-align: justify;
65
+ color: #3e3c47;
66
+ padding-bottom: 2.4rem;
67
+ }
@@ -0,0 +1,86 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ import React from 'react';
3
+ import {
4
+ Title,
5
+ Description,
6
+ Primary,
7
+ PRIMARY_STORY,
8
+ ArgsTable,
9
+ } from '@storybook/addon-docs/blocks';
10
+ import MainProvider from '~context/MainProvider';
11
+ import getPageData from '../../../../../../../tests/factories/pages/default.factory';
12
+ import TemplateOne from '.';
13
+
14
+ const pageData = getPageData();
15
+ pageData.featured_image_object = {
16
+ alt: null,
17
+ filename: '1673344017/456x343px.png',
18
+ height: '343',
19
+ title: '456x343px',
20
+ url: 'https://assets-srv.s3.eu-west-1.amazonaws.com/1673344017/456x343px.png',
21
+ width: '456',
22
+ };
23
+
24
+ export default {
25
+ title: 'Matrix-Theme/Layout/Header/Default/Template One',
26
+ component: TemplateOne,
27
+ argTypes: {
28
+ title: {
29
+ title: 'Title',
30
+ type: { name: 'string', required: true },
31
+ defaultValue: pageData.title,
32
+ description: 'page title',
33
+ },
34
+ description: {
35
+ name: 'Description',
36
+ type: { name: 'string', required: true },
37
+ defaultValue: pageData.description,
38
+ description: 'page description',
39
+ },
40
+ extraFields: {
41
+ name: 'Extra Fields',
42
+ type: { name: 'object', required: true },
43
+ defaultValue: pageData?.extra_fields,
44
+ description: 'page link/CTA',
45
+ },
46
+ imageObj: {
47
+ name: 'Featured image',
48
+ type: { name: 'object', required: true },
49
+ defaultValue: pageData?.featured_image_object,
50
+ description: 'page featured image',
51
+ },
52
+ },
53
+ parameters: {
54
+ docs: {
55
+ description: {
56
+ component: 'A Default Header Component - Template two',
57
+ },
58
+ page: () => (
59
+ <>
60
+ <Title />
61
+ <Description />
62
+ <Primary />
63
+ <ArgsTable story={PRIMARY_STORY} />
64
+ </>
65
+ ),
66
+ },
67
+ },
68
+ };
69
+
70
+ const Template = (args) => (
71
+ <MainProvider
72
+ value={{
73
+ bannerIsActive: false,
74
+ cookieAccepted: true,
75
+ translations: {
76
+ online_casino: 'Online Casino',
77
+ },
78
+ }}
79
+ >
80
+ <div>
81
+ <TemplateOne {...args} />
82
+ </div>
83
+ </MainProvider>
84
+ );
85
+ export const Default = Template.bind({});
86
+ Default.args = {};
@@ -0,0 +1,80 @@
1
+ import React from 'react';
2
+ import { render, cleanup } from '@testing-library/react';
3
+ import '@testing-library/jest-dom/extend-expect';
4
+
5
+ import { getExtraField, imagePrettyUrl } from 'gatsby-core-theme/src/helpers/getters';
6
+ import MainProvider from '~context/MainProvider';
7
+ import getPageData from '../../../../../../../tests/factories/pages/default.factory';
8
+ import TemplateOne from '.';
9
+
10
+ const translations = {
11
+ online_casino: 'Online Casino',
12
+ };
13
+
14
+ function renderComponent(pageData) {
15
+ return render(
16
+ <MainProvider
17
+ value={{
18
+ bannerIsActive: false,
19
+ cookieAccepted: true,
20
+ translations,
21
+ }}
22
+ >
23
+ <TemplateOne
24
+ title={pageData.title}
25
+ description={pageData.description}
26
+ extraFields={pageData.extra_fields}
27
+ imageObj={pageData.featured_image_object}
28
+ />
29
+ </MainProvider>
30
+ );
31
+ }
32
+
33
+ let data;
34
+
35
+ beforeEach(() => {
36
+ data = getPageData();
37
+ });
38
+ describe('Show template one', () => {
39
+ test('render with props', () => {
40
+ const { container } = renderComponent(data);
41
+ expect(container.querySelector('.templateOne')).toBeTruthy();
42
+ });
43
+ test('show correct title', () => {
44
+ const { container } = renderComponent(data);
45
+ expect(container.querySelector('.headerContainer').querySelector('h1')).toBeTruthy();
46
+ expect(container.querySelector('.headerContainer').querySelector('h1').innerHTML).toEqual(
47
+ data.title
48
+ );
49
+ });
50
+ test('show correct description', () => {
51
+ const { container } = renderComponent(data);
52
+ expect(container.querySelector('.headerContainer').querySelector('div').innerHTML).toEqual(
53
+ data.description
54
+ );
55
+ });
56
+ test('show correct url', () => {
57
+ const { container } = renderComponent(data);
58
+ expect(
59
+ container.querySelector('.headerContainer').querySelector('a').innerHTML.split('<svg')[0]
60
+ ).toEqual(getExtraField(data?.extra_fields, 'link'));
61
+ });
62
+ test('show correct image', () => {
63
+ const imgObj = data.featured_image_object;
64
+
65
+ // eslint-disable-next-line global-require
66
+ const func = require('gatsby-core-theme/src/helpers/device-detect');
67
+ func.isNativeImageLazyLoadingSupported = jest.fn(() => true);
68
+ const { container } = renderComponent(data);
69
+
70
+ expect(container.querySelector('img')).toBeTruthy();
71
+ expect(container.querySelector('img')).toHaveAttribute(
72
+ 'src',
73
+ imagePrettyUrl(imgObj.filename, imgObj.width, imgObj.height)
74
+ );
75
+ expect(container.querySelector('img')).toHaveAttribute('loading', 'eager');
76
+ });
77
+ });
78
+ afterEach(() => {
79
+ cleanup();
80
+ });