gatsby-core-theme 1.6.19 → 2.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 (39) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/gatsby-node.esm.js +23 -14
  3. package/package.json +2 -2
  4. package/src/components/app.js +4 -0
  5. package/src/components/atoms/iframe/index.js +15 -9
  6. package/src/components/atoms/menu/items/item/index.js +9 -1
  7. package/src/components/atoms/selling-points/index.js +1 -2
  8. package/src/components/atoms/selling-points/selling-points.module.scss +12 -5
  9. package/src/components/atoms/selling-points/selling-points.test.js +1 -1
  10. package/src/components/molecules/content/index.js +5 -1
  11. package/src/components/molecules/footer/footer.test.js +22 -22
  12. package/src/components/molecules/footer/index.js +3 -1
  13. package/src/components/molecules/header/index.js +7 -2
  14. package/src/components/molecules/link-list/index.js +9 -12
  15. package/src/components/molecules/menu/index.js +6 -1
  16. package/src/components/molecules/operator-banner/operator-banner.test.js +0 -1
  17. package/src/components/molecules/search/index.js +5 -3
  18. package/src/components/molecules/slider/index.js +6 -2
  19. package/src/components/molecules/slider/slider.test.js +30 -23
  20. package/src/components/molecules/star-rating/index.js +8 -24
  21. package/src/components/molecules/star-rating/star-rating.module.scss +13 -1
  22. package/src/components/molecules/star-rating/star-rating.test.js +4 -2
  23. package/src/components/molecules/tnc/index.js +2 -3
  24. package/src/components/molecules/tnc/tnc.test.js +0 -1
  25. package/src/components/molecules/toplist/default-row/index.js +22 -20
  26. package/src/components/organisms/navigation/index.js +9 -1
  27. package/src/components/pages/search/index.js +3 -2
  28. package/src/helpers/device-detect.js +5 -6
  29. package/src/helpers/events.js +91 -0
  30. package/src/helpers/generators.js +11 -3
  31. package/src/helpers/generators.test.js +34 -12
  32. package/src/helpers/processor/sports.js +0 -2
  33. package/src/helpers/rating.js +2 -0
  34. package/src/helpers/schedule.js +0 -36
  35. package/src/hooks/lazy-image/index.js +30 -44
  36. package/src/hooks/tabs/index.js +4 -2
  37. package/src/hooks/tabs/tabs.test.js +32 -15
  38. package/src/styles/utils/_mixins.scss +42 -0
  39. package/src/styles/utils/variables/_main.scss +8 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,95 @@
1
+ # [2.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v1.6.22...v2.0.0) (2021-12-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add function to transform event datetime ([7167a6b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7167a6b52e0a19064f2a906fe30a4cccfeca41e4))
7
+ * added full date format in currentdate placeholder ([275d9d3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/275d9d3b9b2394acfe8074e50ada241c86aee133))
8
+ * added lazyload if native lazy is not supported ([d27115c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d27115cca38920a11fdca342d3eb631490ee0108))
9
+ * added translation in toplist default row ([c4c100e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c4c100eb9e1b5ce67e72bb42551cbb37311969f7))
10
+ * content fix ([73a6eac](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/73a6eac2cbc4c1bb428312b95867e844c2c2abcd))
11
+ * content module removed parser and used replace function ([cc2973f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cc2973f42e6db2fcd999879e97af502092d65324))
12
+ * lazyimage component ([5230b91](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5230b91bbde26015ebaf49621d8c47207b20d3c6))
13
+ * removed direct mutating, and wip on replacing all events with updated timezone ([1571eb8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1571eb86149eedc74c9a69c77102ceb10d16c9aa))
14
+ * removed function that changes root scss variables ([0b60602](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0b60602002774f3c9d3b2895f87574e3c6c75d44))
15
+ * removed unused lazyloads ([9cc1c5c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9cc1c5c4a89d3e67fe65d85c2e57dd6854dd76a4))
16
+ * replace star svg with css ([868e3a2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/868e3a20ce2804c3deab67d62f64348e657bdbf1))
17
+ * return main component as it was ([db3aca5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/db3aca55c82839d0d281b77b7225a6f75d35c1d7))
18
+ * selling points icon color moved to css var ([7283fc1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7283fc1ef56a7fae24acca91f65a72c0752cd635))
19
+ * selling points tick ([71b3aaf](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/71b3aaf4105c6584ede11791cac14a04f8fe9338))
20
+ * small fix ([f6444c1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f6444c1f7421dd9063e9029d02eb8441ec10ffc3))
21
+ * small issue ([43be83b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/43be83bdd5fa5b3d5fe13160a78432a9963c33ec))
22
+ * small issue ([1d49e35](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1d49e357d2098c557d0f7b16e6ab9d7033f16674))
23
+ * test fixed issue ([320e030](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/320e030e49a8c6d7e461578d01e72c2948bdec5a))
24
+ * tests and lazy iframe ([c0b63d5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c0b63d5445f85f7e6b5539b628f516ecbc86547d))
25
+ * tests and lazy iframe ([364f449](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/364f449965ee3998b2dbbdb5132c6a91951ff000))
26
+ * toplist row images ([3ffeb17](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3ffeb17696e2d82fe8b9841defe2b6e78be1e68b))
27
+
28
+
29
+ ### Code Refactoring
30
+
31
+ * add error handling for invalid date ([caa308b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/caa308b9b50352228d86d031c449918c7d81840a))
32
+ * remove unneeded function ([d2fb77a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d2fb77a3810e5b767b716d87db4fb63853995d46))
33
+ * tabs set to loadable ([9079a60](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9079a60aaead65be9d70629fdd1025ce46ed8db8))
34
+ * translations change on operator cta ([0a476cf](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0a476cf2f1ab02eeba06db8af9eaf692b9715b75))
35
+ * translations change on operator cta ([ee9fded](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ee9fded3227ab34287d539676bc581bcb1a5abee))
36
+ * update placeholders generation for meta tags ([0a4e14b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0a4e14bf2f594a7c28b5698df06436df43bd378c))
37
+
38
+
39
+ ### Config
40
+
41
+ * merged master ([08e4355](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/08e43557f6f3827f612fed9448d0db5a5d65577a))
42
+
43
+
44
+ * Merge branch 'add_timezone_prefix' into 'master' ([b5d22b5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b5d22b57eb52d8ed97e2928706c98d437a08738b))
45
+ * Merge branch 'tm-2617-update-placeholders-for-meta-tags' into 'master' ([9c5bf49](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9c5bf492688ddb28d01182a5f46ce18d8f7342d6))
46
+ * Merge branch 'cta-play-now' into 'master' ([29107c4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/29107c4da0339cb798b4c6b5c9dfe98c69bab015))
47
+ * Merge branch 'master' into cta-play-now ([f6aa117](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f6aa11733e67c700aa44fd8dec7b918c8d3db661))
48
+ * Merge branch 'selling-points' into 'master' ([4dc0e96](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4dc0e96e48f5219bbeede529fd346e16ede5b514))
49
+ * Merge branch 'star-rating' into 'master' ([ecc5e24](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ecc5e24f9e9f45e72c1ee50dd552fb1a68d04f44))
50
+ * Update .env.development ([a91cd2f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a91cd2fc6355e31644d22749cb98ec1e2c81160a))
51
+
52
+ ## [1.6.22](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v1.6.21...v1.6.22) (2021-12-10)
53
+
54
+
55
+ ### Bug Fixes
56
+
57
+ * tests ([c8f7780](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c8f7780b257ef1994244217d9d20c2c934a43859))
58
+
59
+
60
+ ### Code Refactoring
61
+
62
+ * using loadable for components set to visible against a condition ([16e23e0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/16e23e06b835f7b41a303f1ff317d3dc19dd1d9c))
63
+
64
+
65
+ * Merge branch 'performance-improvements' into 'master' ([a853c75](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a853c75bcdafe099f4b8b4e13485477503c0fc85))
66
+
67
+ ## [1.6.21](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v1.6.20...v1.6.21) (2021-12-07)
68
+
69
+
70
+ ### Bug Fixes
71
+
72
+ * trackers ([5ad12eb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5ad12ebc2492172f7a94d680315f67b8e19fc4f9))
73
+
74
+ ## [1.6.20](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v1.6.19...v1.6.20) (2021-12-07)
75
+
76
+
77
+ ### Bug Fixes
78
+
79
+ * close menu onclick a link ([ce4d9bb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ce4d9bbf8733bdbe3b09f7fd84226e6a084b42a7))
80
+ * implement for all core sites ([e5c46c0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e5c46c0bee4cf5555990d7c9c5d53bc43a2c6722))
81
+ * small issue ([30fd7e3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/30fd7e305935a00ec514321a5ca8e5a79545681c))
82
+ * small issue ([c1c29ce](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c1c29cedca7be589e2b3f23a7d25a399f1cb7ca5))
83
+
84
+
85
+ ### Code Refactoring
86
+
87
+ * add custom styles to menu ([f686a60](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f686a6059786b6c4f43cf24041f383a5bd19c0d7))
88
+
89
+
90
+ * Merge branch 'tm-navigation-sticky' into 'master' ([0593868](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/05938683ca72db7677d3052f72fadbc26a2db613))
91
+ * Merge branch 'navigation-menu' into 'master' ([d812530](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d8125309b039694c6e35b54d3629134697b407f4))
92
+
1
93
  ## [1.6.19](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v1.6.18...v1.6.19) (2021-12-06)
2
94
 
3
95
 
@@ -5,7 +5,7 @@
5
5
  import { cloneDeep, chunk, pick } from 'lodash';
6
6
  import chalk from 'chalk';
7
7
  import { getData, getLocalData } from './src/helpers/api';
8
- import { generateMetaTitle, generateTrackerLink } from './src/helpers/generators';
8
+ import { generateMetaString, generateTrackerLink } from './src/helpers/generators';
9
9
  import processor, { processSitemapPages } from './src/helpers/processor';
10
10
  import { pickAuthorsPageKeys } from './src/constants/pick-keys';
11
11
 
@@ -211,8 +211,19 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
211
211
  page.authors = Object.keys(authors || {}).map((key) =>
212
212
  pick(authors[key], pickAuthorsPageKeys)
213
213
  );
214
- // Done for matrix-theme sites for [MONTH][YEAR] auto update
215
- page.meta_title = page.meta_title && generateMetaTitle(page.meta_title, translations);
214
+ // Done for matrix-theme sites for placeholders auto update
215
+ page.meta_title =
216
+ page.meta_title &&
217
+ generateMetaString(page.meta_title, translations, {
218
+ siteName: response.general.site_name,
219
+ siteTitle: page.title,
220
+ });
221
+ page.meta_description =
222
+ page.meta_description &&
223
+ generateMetaString(page.meta_description, translations, {
224
+ siteName: response.general.site_name,
225
+ siteTitle: page.title,
226
+ });
216
227
 
217
228
  const contextData = {
218
229
  page,
@@ -253,16 +264,6 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
253
264
  });
254
265
  }
255
266
 
256
- const trackerPageObject = {
257
- meta_title: 'Tracker',
258
- template: 'tracker',
259
- title: 'Tracker',
260
- type: 'page',
261
- language: languageKey,
262
- path: '',
263
- meta_robots: ['noindex', 'nofollow'],
264
- };
265
-
266
267
  // Operator tracker pages
267
268
  if (page.type === 'operator') {
268
269
  const operator = operators[page.relation_id];
@@ -272,7 +273,15 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
272
273
  );
273
274
  tracker.forEach((trackerPath) => {
274
275
  // Create splash page
275
- trackerPageObject['path'] = trackerPath;
276
+ const trackerPageObject = {
277
+ meta_title: 'Tracker',
278
+ template: 'tracker',
279
+ title: 'Tracker',
280
+ type: 'page',
281
+ language: languageKey,
282
+ path: trackerPath,
283
+ meta_robots: ['noindex', 'nofollow'],
284
+ };
276
285
  createPage({
277
286
  path: trackerPath,
278
287
  component: require.resolve('./src/components/app.js'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "1.6.19",
3
+ "version": "2.0.0",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -85,7 +85,7 @@
85
85
  "babel-preset-gatsby": "^1.3.0",
86
86
  "eslint-import-resolver-alias": "^1.1.2",
87
87
  "eslint-plugin-react": "^7.22.0",
88
- "gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.24",
88
+ "gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.26",
89
89
  "identity-obj-proxy": "^3.0.0",
90
90
  "jest": "^26.6.3",
91
91
  "react-test-renderer": "^17.0.1",
@@ -66,6 +66,10 @@ const App = ({ pageContext }) => {
66
66
 
67
67
  const TrackerContent = isTracker ? loadable(() => import(`~pages/tracker`)) : null;
68
68
 
69
+ if (pageContext.siteInfo?.site_name === 'playcasino.co.za') {
70
+ translations.play_now = 'Play now';
71
+ }
72
+
69
73
  return isTracker ? (
70
74
  <>
71
75
  <Head page={pageContext.page} siteInfo={pageContext.siteInfo} />
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import LazyLoad from 'react-lazyload';
4
-
3
+ import loadable from '@loadable/component';
4
+ import { isNativeImageLazyLoadingSupported } from '~helpers/device-detect';
5
5
  import styles from './iframe.module.scss';
6
6
 
7
7
  const Iframe = ({
@@ -10,9 +10,10 @@ const Iframe = ({
10
10
  minHeight = '45rem',
11
11
  lazyLoad = true,
12
12
  frameBorder = 1,
13
- }) => (
14
- <div className={styles.iframeContainer}>
15
- {lazyLoad ? (
13
+ }) => {
14
+ if (!isNativeImageLazyLoadingSupported() && lazyLoad) {
15
+ const LazyLoad = loadable(() => import(`react-lazyload`));
16
+ return (
16
17
  <LazyLoad>
17
18
  <iframe
18
19
  title={title}
@@ -21,16 +22,21 @@ const Iframe = ({
21
22
  frameBorder={frameBorder}
22
23
  />
23
24
  </LazyLoad>
24
- ) : (
25
+ );
26
+ }
27
+
28
+ return (
29
+ <div className={styles.iframeContainer}>
25
30
  <iframe
26
31
  title={title}
27
32
  style={{ width: '100%', minHeight, display: 'block' }}
28
33
  src={src}
34
+ loading={lazyLoad ? 'lazy' : 'eager'}
29
35
  frameBorder={frameBorder}
30
36
  />
31
- )}
32
- </div>
33
- );
37
+ </div>
38
+ );
39
+ };
34
40
 
35
41
  Iframe.propTypes = {
36
42
  src: PropTypes.string.isRequired,
@@ -1,9 +1,10 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import React, { useState, useEffect, useContext } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import Link from '~hooks/link';
4
4
  import useIsMobile from '~hooks/useIsMobile';
5
5
  import ConditionalWrapper from '~atoms/conditional-wrapper';
6
6
  import { imagePrettyUrl } from '~helpers/getters';
7
+ import { NavigationContext } from '~organisms/navigation/navigationContext';
7
8
 
8
9
  import styles from './item.module.scss';
9
10
 
@@ -21,6 +22,8 @@ export default function Item({
21
22
  const [active, setActive] = useState('');
22
23
  const [opened, setOpened] = useState(false);
23
24
 
25
+ const { setShowMenu } = useContext(NavigationContext);
26
+
24
27
  useEffect(() => {
25
28
  const url = typeof window !== 'undefined' ? new URL(window.location.href) : '';
26
29
  setActive(
@@ -28,6 +31,10 @@ export default function Item({
28
31
  );
29
32
  }, [active, item]);
30
33
 
34
+ const handleClose = () => {
35
+ setShowMenu(false);
36
+ };
37
+
31
38
  const toggleDropDown = (e) => {
32
39
  e.target.classList.toggle(styles.active);
33
40
  setOpened(e.target.classList.contains(styles.active));
@@ -84,6 +91,7 @@ export default function Item({
84
91
  title={item.title}
85
92
  rel={item.nofollow && 'nofollow'}
86
93
  aria-label={`${item?.title} link`}
94
+ onClick={handleClose}
87
95
  >
88
96
  <ItemImage />
89
97
  {item.title}
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import LazyLoad from 'react-lazyload';
4
3
 
5
4
  import keygen from '~helpers/keygen';
6
5
  import styles from './selling-points.module.scss';
@@ -13,7 +12,7 @@ const SellingPoints = ({ sellingPoints, icon, limit = 3 }) => {
13
12
  <ul className={styles.sellingPoint}>
14
13
  {sellingPoints.slice(0, limit).map((item) => (
15
14
  <li key={keygen()}>
16
- {icon && <LazyLoad once>{icon}</LazyLoad>}
15
+ <span className={`${icon && styles.tick}`}>{` `}</span>
17
16
  <span>{item}</span>
18
17
  </li>
19
18
  ))}
@@ -7,11 +7,18 @@
7
7
  font-size: 1.4rem;
8
8
  width: 100%;
9
9
 
10
- svg {
11
- margin-right: 1rem;
12
- font-weight: 700;
13
- color: var(--color-22);
14
- flex: 0 0 1.4rem;
10
+ .tick {
11
+ position: relative;
12
+ margin-left: 2rem;
13
+ &::before {
14
+ @include arrow(var(--selling-point-icon-color), 1.5rem, down, false);
15
+ position: absolute;
16
+ padding: 0px 0px .8rem .32rem;
17
+ border-right-width: .18rem;
18
+ border-bottom-width: .18rem;
19
+ bottom: -.3rem;
20
+ left: -1.8rem;
21
+ }
15
22
  }
16
23
  }
17
24
 
@@ -24,7 +24,7 @@ describe('Selling Points Component', () => {
24
24
  const { container } = render(
25
25
  <SellingPoints sellingPoints={sellingPointsList} icon={<p>test icon</p>} />
26
26
  );
27
- expect(container.querySelectorAll('.lazyload-placeholder')).toHaveLength(3);
27
+ expect(container.querySelectorAll('.tick')).toHaveLength(3);
28
28
  });
29
29
 
30
30
  test('test empty selling point list', () => {
@@ -1,9 +1,12 @@
1
+ /* eslint-disable react/forbid-prop-types */
2
+ /* eslint-disable react/no-danger */
1
3
  import React from 'react';
2
- import parse from 'html-react-parser';
3
4
  import PropTypes from 'prop-types';
5
+ import parse from 'html-react-parser';
4
6
 
5
7
  import LazyImage from '~hooks/lazy-image';
6
8
  import { parseCss } from '~helpers/css-parser';
9
+
7
10
  import styles from './content.module.scss';
8
11
 
9
12
  const Content = ({ module, pageContext = null }) => {
@@ -49,6 +52,7 @@ const Content = ({ module, pageContext = null }) => {
49
52
  };
50
53
 
51
54
  Content.propTypes = {
55
+ pageContext: PropTypes.object,
52
56
  module: PropTypes.shape({
53
57
  anchor_label: PropTypes.string,
54
58
  name: PropTypes.string,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { render, cleanup } from '@testing-library/react';
2
+ import { render, cleanup, waitFor } from '@testing-library/react';
3
3
  import '@testing-library/jest-dom/extend-expect';
4
4
 
5
5
  import getFooterSection from '~tests/factories/sections/footer.factory';
@@ -8,7 +8,7 @@ import Footer from '.';
8
8
  const footerSection = getFooterSection();
9
9
 
10
10
  describe('Footer Component', () => {
11
- test('render footer menu items', () => {
11
+ test('render footer menu items', async () => {
12
12
  const { getByText } = render(
13
13
  <Footer
14
14
  footerMenu="footer_links"
@@ -16,27 +16,26 @@ describe('Footer Component', () => {
16
16
  section={footerSection.sections.footer}
17
17
  />
18
18
  );
19
- expect(getByText('test1sub1')).toBeTruthy();
20
- expect(getByText('test1sub1').closest('a').getAttribute('href')).toEqual('/test1sub1link');
21
- expect(getByText('test1sub2')).toBeTruthy();
22
- expect(getByText('test1sub2').closest('a').getAttribute('href')).toEqual('/test1sub2link');
23
- expect(getByText('test1sub2').closest('ul').children.length).toBe(3);
24
19
 
25
- expect(getByText('test2sub1')).toBeTruthy();
26
- expect(getByText('test2sub1').closest('a').getAttribute('href')).toEqual('/test2sub1link');
27
- expect(getByText('test2sub2')).toBeTruthy();
28
- expect(getByText('test2sub2').closest('a').getAttribute('href')).toEqual('/test2sub2link');
29
- expect(getByText('test2sub2').closest('ul').children.length).toBe(3);
20
+ await waitFor(() => {
21
+ expect(getByText('test1sub1')).toBeTruthy();
22
+ expect(getByText('test1sub1').closest('a').getAttribute('href')).toEqual('/test1sub1link');
23
+ expect(getByText('test1sub2')).toBeTruthy();
24
+ expect(getByText('test1sub2').closest('a').getAttribute('href')).toEqual('/test1sub2link');
25
+ expect(getByText('test1sub2').closest('ul').children.length).toBe(3);
26
+
27
+ expect(getByText('test2sub1')).toBeTruthy();
28
+ expect(getByText('test2sub1').closest('a').getAttribute('href')).toEqual('/test2sub1link');
29
+ expect(getByText('test2sub2')).toBeTruthy();
30
+ expect(getByText('test2sub2').closest('a').getAttribute('href')).toEqual('/test2sub2link');
31
+ expect(getByText('test2sub2').closest('ul').children.length).toBe(3);
32
+ });
30
33
  });
31
34
 
32
35
  test('render footer extra component', () => {
33
- const FooterTop = () => {
34
- return <>Test Extra component</>;
35
- };
36
+ const FooterTop = () => <>Test Extra component</>;
36
37
 
37
- const FooterBottom= () => {
38
- return <>Test Extra component2</>;
39
- };
38
+ const FooterBottom = () => <>Test Extra component2</>;
40
39
 
41
40
  const { getByText } = render(
42
41
  <Footer
@@ -51,7 +50,7 @@ describe('Footer Component', () => {
51
50
  expect(getByText('Test Extra component2')).toBeTruthy();
52
51
  });
53
52
 
54
- test('render logo list', () => {
53
+ test('render logo list', async () => {
55
54
  const { getByTitle } = render(
56
55
  <Footer
57
56
  footerMenu="footer_links"
@@ -59,9 +58,10 @@ describe('Footer Component', () => {
59
58
  section={footerSection.sections.footer}
60
59
  />
61
60
  );
62
-
63
- expect(getByTitle('logo1')).toBeTruthy();
64
- expect(getByTitle('logo2')).toBeTruthy();
61
+ await waitFor(() => {
62
+ expect(getByTitle('logo1')).toBeTruthy();
63
+ expect(getByTitle('logo2')).toBeTruthy();
64
+ });
65
65
  });
66
66
  });
67
67
  afterEach(() => {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import LinkList from '~molecules/link-list';
3
+ import loadable from '@loadable/component';
4
4
  import { getExtraField, copyrightText } from '~helpers/getters';
5
5
  import styles from './footer.module.scss';
6
6
 
@@ -19,6 +19,8 @@ const Footer = ({
19
19
  const BottomSection = footerBottomCustom;
20
20
  const showLinks = template !== 'ppc';
21
21
 
22
+ const LinkList = footerMenu && showLinks ? loadable(() => import('~molecules/link-list')) : null;
23
+
22
24
  return (
23
25
  <footer className={styles.footer}>
24
26
  <div className={styles.topPart}>
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
+ import loadable from '@loadable/component';
4
5
  import styles from './header.module.scss';
5
6
  import Breadcrumbs from '~atoms/breadcrumbs';
6
- import Author from '~atoms/author';
7
7
  import { imagePrettyUrl, getSectionExtraField } from '~helpers/getters';
8
8
 
9
9
  // eslint-disable-next-line import/no-named-as-default
@@ -41,6 +41,11 @@ function Header({ section, content = null, backgroundImage = true }) {
41
41
  return <div dangerouslySetInnerHTML={innerBannerHTML()} />;
42
42
  };
43
43
 
44
+ const Author =
45
+ section.page.path !== '/' && section.page.path !== 'contact-us' && section.page.author
46
+ ? loadable(() => import('~atoms/author'))
47
+ : null;
48
+
44
49
  return (
45
50
  <header className={styles.header}>
46
51
  {backgroundImage && backgroundImg}
@@ -51,7 +56,7 @@ function Header({ section, content = null, backgroundImage = true }) {
51
56
  >
52
57
  <div className={styles.topSection}>
53
58
  {section.page.path && <Breadcrumbs page={section.page} />}
54
- {section.page.path !== '/' && section.page.path !== 'contact-us' && section.page.author && (
59
+ {Author && (
55
60
  <div className={styles.authorContainer}>
56
61
  <Author
57
62
  authorProfile={section.page.author?.profile_page_path}
@@ -26,18 +26,15 @@ const LinkList = ({
26
26
  function renderLinkContent(item, index) {
27
27
  const icon = listIcon[index];
28
28
 
29
- const LinkImage = () => {
30
- return disableLazyLoad ? (
31
- <img src={imagePrettyUrl(item.image)} width={width} height={height} alt={item.title} />
32
- ) : (
33
- <LazyImage
34
- src={imagePrettyUrl(item.image)}
35
- alt={item.title}
36
- width={width}
37
- height={height}
38
- />
39
- );
40
- };
29
+ const LinkImage = () => (
30
+ <LazyImage
31
+ src={imagePrettyUrl(item.image)}
32
+ alt={item.title}
33
+ width={width}
34
+ height={height}
35
+ loading={disableLazyLoad ? 'eager' : 'loading'}
36
+ />
37
+ );
41
38
 
42
39
  return (
43
40
  <>
@@ -27,6 +27,7 @@ const Menu = ({
27
27
  },
28
28
  },
29
29
  gtmClass = '',
30
+ customStyles,
30
31
  }) => {
31
32
  let menuObject;
32
33
 
@@ -62,7 +63,10 @@ const Menu = ({
62
63
  return (
63
64
  <div className={styles.menuContainer}>
64
65
  <MenuIcon onClick={handleMenuIconClick} gtmClass="main-menu-gtm" />
65
- <ul ref={menuListRef} className={`${menuListClasses} ${showMenu && styles.show}`}>
66
+ <ul
67
+ ref={menuListRef}
68
+ className={`${menuListClasses} ${showMenu && styles.show} ${styles[customStyles]}`}
69
+ >
66
70
  {menuObject &&
67
71
  menuObject.children.map((child) => {
68
72
  return (
@@ -113,6 +117,7 @@ Menu.propTypes = {
113
117
  }).isRequired,
114
118
  menu: PropTypes.string.isRequired,
115
119
  gtmClass: PropTypes.string,
120
+ customStyles: PropTypes.string,
116
121
  };
117
122
 
118
123
  export default Menu;
@@ -12,7 +12,6 @@ describe('OperatorBanner Component', () => {
12
12
  );
13
13
  expect(container).toBeTruthy();
14
14
  expect(container.querySelectorAll('.sticky')).toHaveLength(1);
15
- expect(container.querySelectorAll('.lazyload-placeholder')).toHaveLength(1);
16
15
  expect(getByText('Rizk Casino')).toBeTruthy();
17
16
  expect(getByText('Visit')).toBeTruthy();
18
17
  });
@@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef, useCallback, useContext } from 'rea
2
2
  import PropTypes from 'prop-types';
3
3
  import { navigate } from 'gatsby';
4
4
  import { FaSearch } from 'react-icons/fa';
5
-
5
+ import loadable from '@loadable/component';
6
6
  import LazyImage from '~hooks/lazy-image';
7
7
  import ConditionalWrapper from '~atoms/conditional-wrapper';
8
8
  import styles from './search.module.scss';
@@ -12,9 +12,7 @@ import keygen from '~helpers/keygen';
12
12
  import { filterByKey, sortDateOn, sortIntOn, sortStringOn } from '~helpers/search';
13
13
  import loadSource from '~helpers/search-source';
14
14
  import { leftTrim } from '~helpers/strings';
15
- import Archive from '~organisms/archive';
16
15
  import ModuleTitle from '~atoms/module-title';
17
- import CustomSelect from '~atoms/custom-select';
18
16
  import { NavigationContext } from '~organisms/navigation/navigationContext';
19
17
 
20
18
  /* eslint-disable no-underscore-dangle */
@@ -213,6 +211,8 @@ const Search = ({
213
211
  }
214
212
  }, [pageSearchOptionsCopy]);
215
213
  if (pageSearchOptionsCopy !== null && pageSearchOptionsCopy.sort !== undefined) {
214
+ const CustomSelect = loadable(() => import('~atoms/custom-select'));
215
+
216
216
  pageSearchOptionsCopy.tabsOptions.HeaderComp = (
217
217
  <div className={styles.selectwrapper}>
218
218
  <CustomSelect
@@ -343,6 +343,8 @@ const Search = ({
343
343
 
344
344
  if (items.length === 0) return null;
345
345
 
346
+ const Archive = loadable(() => import('~organisms/archive'));
347
+
346
348
  return (
347
349
  <div label={titleObj.title} tabId={type + index} key={keygen()}>
348
350
  {pageSearchOptionsCopy.useArchive === undefined ||
@@ -2,6 +2,7 @@
2
2
  /* eslint-disable react-hooks/exhaustive-deps */
3
3
  import React, { useState, useRef, useEffect } from 'react';
4
4
  import PropTypes, { element } from 'prop-types';
5
+ import loadable from '@loadable/component';
5
6
 
6
7
  import {
7
8
  updateSlider,
@@ -14,7 +15,6 @@ import {
14
15
 
15
16
  import styles from './slider.module.scss';
16
17
  import Arrow from '~atoms/carousel/arrow';
17
- import Pagination from '~atoms/carousel/pagination-item';
18
18
 
19
19
  function Slider({
20
20
  gtmClass = '',
@@ -179,6 +179,10 @@ function Slider({
179
179
  };
180
180
  });
181
181
 
182
+ const Pagination = usePagination
183
+ ? loadable(() => import('~atoms/carousel/pagination-item'))
184
+ : null;
185
+
182
186
  return (
183
187
  state.length > 0 && (
184
188
  <div className={`${className} ${styles.slider}`} ref={sliderContainerRef}>
@@ -221,7 +225,7 @@ function Slider({
221
225
  </div>
222
226
  ))}
223
227
  </div>
224
- {usePagination && (
228
+ {Pagination && (
225
229
  <Pagination
226
230
  type="dots"
227
231
  paginationHandler={paginationHandler}