gatsby-matrix-theme 19.0.1 → 19.0.3

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,35 @@
1
+ ## [19.0.3](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v19.0.2...v19.0.3) (2023-04-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * added author link as optional ([3e4ef4d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/3e4ef4d2b4e3a814c47e88c250eb5829eb259fca))
7
+
8
+
9
+ ### Code Refactoring
10
+
11
+ * update mobile device detect import and implementation ([08218c5](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/08218c5f4f489c665645f9771aa70e3b5ead4d5b))
12
+
13
+
14
+ * Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/matrix-theme ([be5c739](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/be5c739cbf2a15f3c3884d175712849efc89a550))
15
+ * Merge branch 'tm-3348-remove-is-mobile-func' into 'master' ([edbceb8](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/edbceb8d75b78469cce114092bc91bf86aa1e201))
16
+
17
+ ## [19.0.2](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v19.0.1...v19.0.2) (2023-04-12)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * article styling ([6d7e98d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/6d7e98da6da7eda8c1039d7cf7ae3a5d9cc03010))
23
+ * conflicts ([60b9650](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/60b9650b58b61b5ab6e57072c6f8a48da75c76cb))
24
+ * faq display front end matrix ([d379930](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/d37993016fa3866e9ad955b3c0accc5f9f09967c))
25
+ * tests ([b78f03e](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/b78f03e921475209f0af76e5a2919c21d5cf1fb5))
26
+ * tests ([7145589](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/7145589aad290e31505ab3a8a8eff5a81f51ba3a))
27
+ * updaet core version ([6bf6788](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/6bf6788f12ea33fa4248f0f4418fa12d23e74159))
28
+
29
+
30
+ * Merge branch 'tm-3311-article-cards' into 'master' ([96cd092](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/96cd092a2d7d0d9ee049465385d5e5c531be1590))
31
+ * Merge branch 'tm-3381-faq-section-matrix' into 'master' ([88a229b](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/88a229b815777a3e75d70b27e76755cc03f43aa1))
32
+
1
33
  ## [19.0.1](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v19.0.0...v19.0.1) (2023-04-12)
2
34
 
3
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-matrix-theme",
3
- "version": "19.0.1",
3
+ "version": "19.0.3",
4
4
  "main": "index.js",
5
5
  "description": "Matrix Theme NPM Package",
6
6
  "author": "",
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@react-icons/all-files": "^4.1.0",
27
27
  "gatsby": "^4.20.0",
28
- "gatsby-core-theme": "20.0.0",
28
+ "gatsby-core-theme": "20.0.1",
29
29
  "gatsby-plugin-sharp": "^4.10.2",
30
30
  "gatsby-plugin-sitemap": "^3.3.0",
31
31
  "gatsby-transformer-sharp": "^4.10.0",
@@ -28,99 +28,57 @@
28
28
  }
29
29
  }
30
30
  }
31
- .cardMeta {
32
- @include flex-direction(row);
31
+
32
+ .image {
33
+ img {
34
+ width: 100%;
35
+ height: 100%;
36
+ object-fit: cover;
37
+ border-radius: 1.2rem;
38
+ }
39
+ }
40
+
41
+ .showAuthorOnOneLine {
33
42
  @include flex-align(center, space-between);
43
+ font-size: 14px;
44
+ line-height: 22px;
34
45
  width: 100%;
46
+ gap: .2rem;
35
47
 
36
- > div {
37
- display: grid;
38
- grid-template-columns: auto 1fr;
48
+ img {
49
+ border-radius: 10rem;
39
50
  }
40
51
 
41
- > div > div {
42
- white-space: normal !important;
43
- > a {
44
- display: block !important;
45
- color: #165af8 !important;
46
- font-size: 1.4rem;
47
- line-height: 21px;
48
- font-weight: 700 !important;
49
- }
50
- > img {
51
- position: absolute;
52
- left: -0.6rem;
53
- max-width: 2.4rem;
54
- max-height: 2.4rem;
55
- }
56
- > span {
57
- font-size: 1.4rem;
58
- line-height: 2.2rem;
59
- color: #3e3c47 !important;
60
- font-weight: 500;
61
- }
62
- > p {
63
- padding-left: 2.8rem;
64
- span {
65
- font-size: 1.4rem;
66
- color: #3e3c47;
67
- font-weight: 400;
68
- line-height: 22px;
69
- text-transform: capitalize;
70
- white-space: nowrap;
71
- }
52
+ > div {
53
+ @include flex-align(flex-start, flex-start);
54
+ gap: .2rem;
55
+ flex-grow: 1;
56
+ >span {
57
+ flex-grow: 1;
58
+ @include flex-align(flex-end, flex-end);
72
59
  }
73
60
  }
74
61
  }
75
- .cardBanner {
76
- a {
77
- width: 100%;
78
- img {
79
- height: 24rem;
80
- object-fit: cover;
81
- width: 100%;
82
- border: var(--cards-border);
83
- border-radius: 1.2rem;
84
- box-sizing: content-box;
85
- }
62
+
63
+ .showAuthorBlock {
64
+ @include flex-align(center, flex-start);
65
+ font-size: 14px;
66
+ line-height: 22px;
67
+ width: 100%;
68
+ gap: .5rem;
69
+
70
+ img {
71
+ border-radius: 10rem;
86
72
  }
87
- }
88
73
 
89
- .showAuthorOnOneLine {
90
- position: relative;
91
74
  > div {
92
- @include flex-direction(column);
93
- @include flex-align(flex-start, center);
94
- > div {
95
- padding-left: 5.6rem;
96
- a {
97
- &::before {
98
- padding: 0 !important;
99
- }
100
- }
101
- > span {
102
- color: #6b6a72 !important;
103
- }
104
- img {
105
- min-width: 4.8rem;
106
- min-height: 4.8rem;
107
- bottom: 0;
108
- margin: 0 auto;
109
- object-fit: cover;
110
- top: -0.25rem;
111
- }
112
- p {
113
- padding-left: 0;
114
- span {
115
- display: none;
116
- }
117
- }
118
- }
119
- }
75
+ @include flex-align(flex-start, flex-start);
76
+ gap: .2rem;
77
+ flex-direction: column;
120
78
 
121
- &.hideDate {
122
- a {
123
- margin: 1.3rem 0;
79
+ >span {
80
+ flex-grow: 1;
81
+ @include flex-align(flex-end, flex-end);
124
82
  }
125
83
  }
126
84
  }
@@ -1,62 +1,72 @@
1
1
  /* eslint-disable import/no-extraneous-dependencies */
2
2
  /* eslint-disable camelcase */
3
- import React from 'react';
3
+ import React, { useContext } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import Link from 'gatsby-core-theme/src/hooks/link';
6
- import { imagePrettyUrl, getSectionExtraField } from 'gatsby-core-theme/src/helpers/getters';
6
+ import { imagePrettyUrl, translate } from 'gatsby-core-theme/src/helpers/getters';
7
7
  import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
8
- import LazyPicture from 'gatsby-core-theme/src/hooks/lazy-picture';
9
- import Author from 'gatsby-core-theme/src/components/atoms/author';
10
-
8
+ import { formatDate } from '~helpers/date-time';
9
+ import { Context } from '~context/MainProvider';
11
10
  import styles from './article-card.module.scss';
12
11
 
13
- const ArticleCard = ({ showAuthorOnOneLine = false, item, width, height, showDate = true }) => {
12
+ const ArticleCard = ({
13
+ showAuthorOnOneLine = false,
14
+ showAuthorAsLink = false,
15
+ item,
16
+ width = 360,
17
+ height = 240,
18
+ showDate = true,
19
+ }) => {
14
20
  const { author, title, path, banner } = item;
15
- const pictureSource = {
16
- webp: '../../../../../../../images/default-article.webp',
17
- fallback: '../../../../../../../images/default-article.jpg',
18
- };
19
- const cardBackgroundImage = getSectionExtraField(null, item, 'card_background_image');
20
- const featured = !!cardBackgroundImage;
21
+ const { translations } = useContext(Context) || {};
22
+ const imgSize = showAuthorOnOneLine ? 30 : 48;
23
+ const date = item?.updated_at || item?.created_at;
24
+ const formatedDate = date && formatDate(date, 'DD.MM.YYYY', '/', 'en-GB');
21
25
 
22
26
  return (
23
27
  <div className={styles.article}>
24
- {!featured && (
25
- <div className={styles.cardBanner}>
26
- <Link to={path} className="article-card-gtm" aria-label={`${title} Link`}>
27
- {banner ? (
28
- <LazyImage width={width} height={height} src={imagePrettyUrl(banner)} alt={title} />
29
- ) : (
30
- <LazyPicture
31
- webp={pictureSource.webp}
32
- fallback={pictureSource.fallback}
33
- alt={title}
34
- />
35
- )}
36
- </Link>
37
- </div>
28
+ {banner && (
29
+ <Link to={path} className={`${styles.image} article-card-gtm`} aria-label={`${title} Link`}>
30
+ <LazyImage
31
+ width={width}
32
+ height={height}
33
+ src={imagePrettyUrl(banner, width, height)}
34
+ alt={title}
35
+ />
36
+ </Link>
38
37
  )}
39
- <div className={`${styles.cardContent} ${featured && styles.featured}`}>
38
+ <div className={`${styles.cardContent}`}>
40
39
  <Link to={path} className="article-card-gtm">
41
40
  <span className={styles.cardTitle}>{title}</span>
42
41
  </Link>
42
+
43
43
  {typeof author === 'object' && (
44
44
  <div
45
- className={`${styles.cardMeta} ${showAuthorOnOneLine && styles.showAuthorOnOneLine} ${
46
- !showDate ? styles.hideDate : ''
47
- }`}
45
+ className={`${
46
+ showAuthorOnOneLine ? styles.showAuthorOnOneLine : styles.showAuthorBlock
47
+ } `}
48
48
  >
49
- <Author
50
- prefix="by"
51
- name={author?.name}
52
- splitDateFormat="/"
53
- isCardsAuthor
54
- authorImg={author?.image}
55
- date={showDate ? item?.updated_at || item?.created_at : null}
56
- link={author?.profile_page_path}
57
- authorImageHeight={showAuthorOnOneLine ? 48 : 30}
58
- authorImageWidth={showAuthorOnOneLine ? 48 : 30}
49
+ <LazyImage
50
+ alt={author?.name}
51
+ width={imgSize}
52
+ height={imgSize}
53
+ src={imagePrettyUrl(author?.image, imgSize, imgSize)}
59
54
  />
55
+ <div>
56
+ {showAuthorOnOneLine && (
57
+ <p>
58
+ <span>{translate(translations, 'by', 'By')}</span>
59
+ </p>
60
+ )}
61
+ {showAuthorAsLink ? (
62
+ <Link to={author?.profile_page_path} title={author?.name}>
63
+ {author?.name}
64
+ </Link>
65
+ ) : (
66
+ <span>{author?.name}</span>
67
+ )}
68
+ {showDate && <span className={styles.noLink}>{formatedDate}</span>}
69
+ </div>
60
70
  </div>
61
71
  )}
62
72
  </div>
@@ -82,6 +92,7 @@ ArticleCard.propTypes = {
82
92
  height: PropTypes.number,
83
93
  showAuthorOnOneLine: PropTypes.bool,
84
94
  showDate: PropTypes.bool,
95
+ showAuthorAsLink: PropTypes.bool,
85
96
  };
86
97
 
87
98
  export default ArticleCard;
@@ -18,28 +18,33 @@ const item = {
18
18
 
19
19
  describe('ArticleCard', () => {
20
20
  it('render Article Card', () => {
21
- const { getByLabelText, getByText } = render(
21
+ const { getByText } = render(
22
22
  <ArticleCard item={item} width={200} height={200} showAuthorOnOneLine={false} />
23
23
  );
24
- expect(getByLabelText('Sample Article Link')).toBeInTheDocument();
24
+
25
25
  expect(getByText('Sample Article')).toBeInTheDocument();
26
26
  expect(getByText('John Doe')).toBeInTheDocument();
27
+ expect(getByText('01/02/2022')).toBeInTheDocument();
27
28
  });
28
29
 
29
30
  it('should render the article card with author on one line', () => {
30
- const { getByLabelText, getByText } = render(
31
+ const { getByText } = render(
31
32
  <ArticleCard item={item} width={200} height={200} showAuthorOnOneLine />
32
33
  );
33
- expect(getByLabelText('Sample Article Link')).toBeInTheDocument();
34
+ expect(getByText('By')).toBeInTheDocument();
35
+ expect(getByText('John Doe')).toBeInTheDocument();
36
+ expect(getByText('01/02/2022')).toBeInTheDocument();
34
37
  expect(getByText('Sample Article')).toBeInTheDocument();
35
38
  });
36
39
 
37
40
  it('without a banner image', () => {
38
41
  const itemWithoutBanner = { ...item, banner: null };
39
- const { getByLabelText, getByText } = render(
42
+ const { getByText } = render(
40
43
  <ArticleCard item={itemWithoutBanner} width={200} height={200} showAuthorOnOneLine={false} />
41
44
  );
42
- expect(getByLabelText('Sample Article Link')).toBeInTheDocument();
45
+
46
+ expect(getByText('John Doe')).toBeInTheDocument();
47
+ expect(getByText('01/02/2022')).toBeInTheDocument();
43
48
  expect(getByText('Sample Article')).toBeInTheDocument();
44
49
  });
45
50
 
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable react/prop-types */
3
3
  /* eslint-disable no-nested-ternary */
4
4
  /* eslint-disable import/no-extraneous-dependencies */
5
- import React, { useContext, useEffect, useState } from 'react';
5
+ import React, { useContext } from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import { Context } from 'gatsby-core-theme/src/context/MainProvider';
8
8
  import Link from 'gatsby-core-theme/src/hooks/link';
@@ -13,7 +13,6 @@ import { imagePrettyUrl, translate, getAltText } from '~helpers/getters';
13
13
  import styles from './oeprator-exlusive.module.scss';
14
14
 
15
15
  const Banner = ({ bonus, template }) => {
16
- const [showTracker, setShowTracker] = useState('');
17
16
  const { value, module_title } = bonus;
18
17
  const [, reviewPath] = value.review_link.split('.co.za/');
19
18
  const splitBy = module_title?.includes('OR') ? 'OR' : module_title?.includes('+') ? '+' : '&';
@@ -22,16 +21,7 @@ const Banner = ({ bonus, template }) => {
22
21
  : bonus?.value?.one_liners?.main?.one_liner.split('+');
23
22
  const { translations } = useContext(Context) || {};
24
23
  const imageObject = value?.standardised_logo_url_object || value?.logo_url_object;
25
-
26
- const isMobile = isMobileDevice();
27
-
28
- useEffect(() => {
29
- if (isMobile) {
30
- setShowTracker('mobbanner');
31
- } else {
32
- setShowTracker('banner');
33
- }
34
- }, [isMobile]);
24
+ const tracker = isMobileDevice() ? 'mobbanner' : 'banner';
35
25
 
36
26
  return (
37
27
  <div className={`${styles.wrapper}`}>
@@ -68,7 +58,7 @@ const Banner = ({ bonus, template }) => {
68
58
  inactive: { translationKey: 'inactive', defaultValue: 'Not Accepting New Players' },
69
59
  blacklisted: { translationKey: 'blacklisted', defaultValue: 'Blacklisted' },
70
60
  }}
71
- tracker={showTracker}
61
+ tracker={tracker}
72
62
  gtmClass="banner-operator-cta-gtm"
73
63
  pageTemplate={template}
74
64
  />
@@ -12,7 +12,7 @@ import {
12
12
  } from 'gatsby-core-theme/src/helpers/getters';
13
13
  import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
14
14
  import { Context } from 'gatsby-core-theme/src/context/MainProvider';
15
- import { isMobileDevice } from '../../../helpers/mobile-detect';
15
+ import { isMobileDevice } from 'gatsby-core-theme/src/helpers/device-detect';
16
16
 
17
17
  import styles from './small-welcome-bonus.module.scss';
18
18
 
@@ -20,12 +20,11 @@ const Index = ({ page }) => {
20
20
  const operator = page?.extra_fields?.game_review_summary_operator;
21
21
  const { logo_url, status } = operator;
22
22
  const { translations } = useContext(Context) || {};
23
- const isMobile = isMobileDevice();
24
23
  const prettyLink = prettyTracker(operator, 'main', false, page.template);
25
24
  let playNow = translate(translations, 'play_now', 'Play now');
26
25
  const bonus = getBonus('main', operator);
27
26
  const logUrlObject = operator?.logo_url_object;
28
- if (isMobile) {
27
+ if (isMobileDevice()) {
29
28
  playNow = `> ${translate(translations, 'play_for_real_at', 'Play for real at')} @ ${
30
29
  operator.name
31
30
  }`;
@@ -11,10 +11,10 @@ import PropTypes from 'prop-types';
11
11
  import { MdClose } from '@react-icons/all-files/md/MdClose';
12
12
  import { translate } from 'gatsby-core-theme/src/helpers/getters';
13
13
  import { Context } from 'gatsby-core-theme/src/context/MainProvider';
14
+ import { isMobileDevice } from 'gatsby-core-theme/src/helpers/device-detect';
14
15
  import Link from 'gatsby-core-theme/src/hooks/link';
15
16
  import PopupCard from '../../atoms/cards/popup-card';
16
17
  import { setIdleTimeout } from '../../../helpers/popup';
17
- import { isMobileDevice } from '../../../helpers/mobile-detect';
18
18
  import months from '../../../constants/months';
19
19
 
20
20
  import styles from './popup.module.scss';
@@ -59,7 +59,11 @@ const Modules = ({ module, page, pageContext, index, exclOperator }) => {
59
59
  case 'spotlights':
60
60
  return loadable(() => import('gatsby-core-theme/src/components/atoms/spotlights'));
61
61
  case 'faq':
62
- return loadable(() => import('../../../../components/molecules/faq'));
62
+ // eslint-disable-next-line react/destructuring-assignment
63
+ if (moduleItem?.display_front_end === '1') {
64
+ return loadable(() => import('../../../../components/molecules/faq'));
65
+ }
66
+ return null;
63
67
  // Template blocks
64
68
  case 'horse_racing_calculator':
65
69
  return loadable(() => import('../../../../components/molecules/horse-calculator'));
@@ -10,7 +10,6 @@ import Slide from '../../../../components/molecules/carousel/screenshot-slide';
10
10
  import styles from './carousel.module.scss';
11
11
 
12
12
  const Carousel = ({ page = {}, module = {}, settings = {}, gtmClass = '' }) => {
13
- const isMobile = isMobileDevice();
14
13
  // render one item per slide
15
14
  const renderOne = (items) => {
16
15
  const arr = [];
@@ -53,7 +52,7 @@ const Carousel = ({ page = {}, module = {}, settings = {}, gtmClass = '' }) => {
53
52
  return arr;
54
53
  };
55
54
 
56
- const renderedItems = isMobile ? renderOne(module.items) : renderTwo(module.items);
55
+ const renderedItems = isMobileDevice() ? renderOne(module.items) : renderTwo(module.items);
57
56
 
58
57
  return (
59
58
  <div className={styles.carouselContainer}>