gatsby-core-theme 1.6.20 → 2.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.
- package/CHANGELOG.md +80 -0
- package/gatsby-node.esm.js +23 -14
- package/package.json +2 -2
- package/src/components/app.js +4 -0
- package/src/components/atoms/iframe/index.js +15 -9
- package/src/components/atoms/selling-points/index.js +1 -2
- package/src/components/atoms/selling-points/selling-points.module.scss +12 -5
- package/src/components/atoms/selling-points/selling-points.test.js +1 -1
- package/src/components/molecules/content/index.js +5 -1
- package/src/components/molecules/footer/footer.test.js +22 -22
- package/src/components/molecules/footer/index.js +3 -1
- package/src/components/molecules/header/index.js +7 -2
- package/src/components/molecules/link-list/index.js +9 -12
- package/src/components/molecules/operator-banner/operator-banner.test.js +0 -1
- package/src/components/molecules/search/index.js +5 -3
- package/src/components/molecules/slider/index.js +6 -2
- package/src/components/molecules/slider/slider.test.js +30 -23
- package/src/components/molecules/star-rating/index.js +8 -24
- package/src/components/molecules/star-rating/star-rating.module.scss +13 -1
- package/src/components/molecules/star-rating/star-rating.test.js +4 -2
- package/src/components/molecules/tnc/index.js +2 -3
- package/src/components/molecules/tnc/tnc.test.js +0 -1
- package/src/components/molecules/toplist/default-row/index.js +22 -20
- package/src/components/pages/search/index.js +3 -2
- package/src/helpers/device-detect.js +5 -6
- package/src/helpers/events.js +91 -0
- package/src/helpers/generators.js +11 -3
- package/src/helpers/generators.test.js +34 -12
- package/src/helpers/processor/sports.js +0 -2
- package/src/helpers/rating.js +2 -0
- package/src/helpers/schedule.js +0 -36
- package/src/hooks/lazy-image/index.js +30 -44
- package/src/hooks/tabs/index.js +4 -2
- package/src/hooks/tabs/tabs.test.js +32 -15
- package/src/styles/utils/_mixins.scss +42 -0
- package/src/styles/utils/variables/_main.scss +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,83 @@
|
|
|
1
|
+
## [2.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.0.0...v2.0.1) (2021-12-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* link list bug ([893b8c1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/893b8c12737a4007c94364ace744e7c1d7459706))
|
|
7
|
+
|
|
8
|
+
# [2.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v1.6.22...v2.0.0) (2021-12-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add function to transform event datetime ([7167a6b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7167a6b52e0a19064f2a906fe30a4cccfeca41e4))
|
|
14
|
+
* added full date format in currentdate placeholder ([275d9d3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/275d9d3b9b2394acfe8074e50ada241c86aee133))
|
|
15
|
+
* added lazyload if native lazy is not supported ([d27115c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d27115cca38920a11fdca342d3eb631490ee0108))
|
|
16
|
+
* added translation in toplist default row ([c4c100e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c4c100eb9e1b5ce67e72bb42551cbb37311969f7))
|
|
17
|
+
* content fix ([73a6eac](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/73a6eac2cbc4c1bb428312b95867e844c2c2abcd))
|
|
18
|
+
* content module removed parser and used replace function ([cc2973f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cc2973f42e6db2fcd999879e97af502092d65324))
|
|
19
|
+
* lazyimage component ([5230b91](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5230b91bbde26015ebaf49621d8c47207b20d3c6))
|
|
20
|
+
* removed direct mutating, and wip on replacing all events with updated timezone ([1571eb8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1571eb86149eedc74c9a69c77102ceb10d16c9aa))
|
|
21
|
+
* removed function that changes root scss variables ([0b60602](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0b60602002774f3c9d3b2895f87574e3c6c75d44))
|
|
22
|
+
* removed unused lazyloads ([9cc1c5c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9cc1c5c4a89d3e67fe65d85c2e57dd6854dd76a4))
|
|
23
|
+
* replace star svg with css ([868e3a2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/868e3a20ce2804c3deab67d62f64348e657bdbf1))
|
|
24
|
+
* return main component as it was ([db3aca5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/db3aca55c82839d0d281b77b7225a6f75d35c1d7))
|
|
25
|
+
* selling points icon color moved to css var ([7283fc1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7283fc1ef56a7fae24acca91f65a72c0752cd635))
|
|
26
|
+
* selling points tick ([71b3aaf](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/71b3aaf4105c6584ede11791cac14a04f8fe9338))
|
|
27
|
+
* small fix ([f6444c1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f6444c1f7421dd9063e9029d02eb8441ec10ffc3))
|
|
28
|
+
* small issue ([43be83b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/43be83bdd5fa5b3d5fe13160a78432a9963c33ec))
|
|
29
|
+
* small issue ([1d49e35](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1d49e357d2098c557d0f7b16e6ab9d7033f16674))
|
|
30
|
+
* test fixed issue ([320e030](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/320e030e49a8c6d7e461578d01e72c2948bdec5a))
|
|
31
|
+
* tests and lazy iframe ([c0b63d5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c0b63d5445f85f7e6b5539b628f516ecbc86547d))
|
|
32
|
+
* tests and lazy iframe ([364f449](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/364f449965ee3998b2dbbdb5132c6a91951ff000))
|
|
33
|
+
* toplist row images ([3ffeb17](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3ffeb17696e2d82fe8b9841defe2b6e78be1e68b))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Code Refactoring
|
|
37
|
+
|
|
38
|
+
* add error handling for invalid date ([caa308b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/caa308b9b50352228d86d031c449918c7d81840a))
|
|
39
|
+
* remove unneeded function ([d2fb77a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d2fb77a3810e5b767b716d87db4fb63853995d46))
|
|
40
|
+
* tabs set to loadable ([9079a60](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9079a60aaead65be9d70629fdd1025ce46ed8db8))
|
|
41
|
+
* translations change on operator cta ([0a476cf](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0a476cf2f1ab02eeba06db8af9eaf692b9715b75))
|
|
42
|
+
* translations change on operator cta ([ee9fded](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ee9fded3227ab34287d539676bc581bcb1a5abee))
|
|
43
|
+
* update placeholders generation for meta tags ([0a4e14b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0a4e14bf2f594a7c28b5698df06436df43bd378c))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Config
|
|
47
|
+
|
|
48
|
+
* merged master ([08e4355](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/08e43557f6f3827f612fed9448d0db5a5d65577a))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
* Merge branch 'add_timezone_prefix' into 'master' ([b5d22b5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b5d22b57eb52d8ed97e2928706c98d437a08738b))
|
|
52
|
+
* Merge branch 'tm-2617-update-placeholders-for-meta-tags' into 'master' ([9c5bf49](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9c5bf492688ddb28d01182a5f46ce18d8f7342d6))
|
|
53
|
+
* Merge branch 'cta-play-now' into 'master' ([29107c4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/29107c4da0339cb798b4c6b5c9dfe98c69bab015))
|
|
54
|
+
* Merge branch 'master' into cta-play-now ([f6aa117](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f6aa11733e67c700aa44fd8dec7b918c8d3db661))
|
|
55
|
+
* Merge branch 'selling-points' into 'master' ([4dc0e96](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4dc0e96e48f5219bbeede529fd346e16ede5b514))
|
|
56
|
+
* Merge branch 'star-rating' into 'master' ([ecc5e24](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ecc5e24f9e9f45e72c1ee50dd552fb1a68d04f44))
|
|
57
|
+
* Update .env.development ([a91cd2f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a91cd2fc6355e31644d22749cb98ec1e2c81160a))
|
|
58
|
+
|
|
59
|
+
## [1.6.22](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v1.6.21...v1.6.22) (2021-12-10)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Bug Fixes
|
|
63
|
+
|
|
64
|
+
* tests ([c8f7780](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c8f7780b257ef1994244217d9d20c2c934a43859))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Code Refactoring
|
|
68
|
+
|
|
69
|
+
* using loadable for components set to visible against a condition ([16e23e0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/16e23e06b835f7b41a303f1ff317d3dc19dd1d9c))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
* Merge branch 'performance-improvements' into 'master' ([a853c75](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a853c75bcdafe099f4b8b4e13485477503c0fc85))
|
|
73
|
+
|
|
74
|
+
## [1.6.21](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v1.6.20...v1.6.21) (2021-12-07)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### Bug Fixes
|
|
78
|
+
|
|
79
|
+
* trackers ([5ad12eb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5ad12ebc2492172f7a94d680315f67b8e19fc4f9))
|
|
80
|
+
|
|
1
81
|
## [1.6.20](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v1.6.19...v1.6.20) (2021-12-07)
|
|
2
82
|
|
|
3
83
|
|
package/gatsby-node.esm.js
CHANGED
|
@@ -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 {
|
|
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
|
|
215
|
-
page.meta_title =
|
|
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
|
|
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": "
|
|
3
|
+
"version": "2.0.1",
|
|
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.
|
|
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",
|
package/src/components/app.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
15
|
-
|
|
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
|
-
|
|
33
|
-
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
34
40
|
|
|
35
41
|
Iframe.propTypes = {
|
|
36
42
|
src: PropTypes.string.isRequired,
|
|
@@ -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 &&
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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('.
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
64
|
-
|
|
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
|
|
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
|
-
{
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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' : 'lazy'}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
41
38
|
|
|
42
39
|
return (
|
|
43
40
|
<>
|
|
@@ -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
|
-
{
|
|
228
|
+
{Pagination && (
|
|
225
229
|
<Pagination
|
|
226
230
|
type="dots"
|
|
227
231
|
paginationHandler={paginationHandler}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render, cleanup, fireEvent, act } from '@testing-library/react';
|
|
2
|
+
import { render, cleanup, fireEvent, act, waitFor } from '@testing-library/react';
|
|
3
3
|
import '@testing-library/jest-dom/extend-expect';
|
|
4
4
|
import keygen from '~helpers/keygen';
|
|
5
5
|
import Slider from '.';
|
|
@@ -12,9 +12,9 @@ describe('Slider Component', () => {
|
|
|
12
12
|
act(() => {
|
|
13
13
|
const { container } = render(
|
|
14
14
|
<Slider useArrows={false} usePagination={false} settings={{ numberOfSlides: 0 }}>
|
|
15
|
-
{list.map((element) =>
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
{list.map((element) => (
|
|
16
|
+
<div key={keygen()}>{element}</div>
|
|
17
|
+
))}
|
|
18
18
|
</Slider>
|
|
19
19
|
);
|
|
20
20
|
|
|
@@ -30,9 +30,9 @@ describe('Slider Component', () => {
|
|
|
30
30
|
const list = ['Summer', 'Autumn', 'Winter', 'Spring'];
|
|
31
31
|
const { container } = render(
|
|
32
32
|
<Slider useArrows={false} usePagination={false} settings={{ numberOfSlides: 0 }}>
|
|
33
|
-
{list.map((element) =>
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
{list.map((element) => (
|
|
34
|
+
<div key={keygen()}>{element}</div>
|
|
35
|
+
))}
|
|
36
36
|
</Slider>
|
|
37
37
|
);
|
|
38
38
|
|
|
@@ -51,20 +51,24 @@ describe('Slider Component', () => {
|
|
|
51
51
|
const list = ['Summer', 'Autumn', 'Winter', 'Spring'];
|
|
52
52
|
const { container } = render(
|
|
53
53
|
<Slider>
|
|
54
|
-
{list.map((element) =>
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
{list.map((element) => (
|
|
55
|
+
<div key={keygen()}>{element}</div>
|
|
56
|
+
))}
|
|
57
57
|
</Slider>
|
|
58
58
|
);
|
|
59
59
|
|
|
60
60
|
const prev = container.querySelector('button.left');
|
|
61
61
|
const next = container.querySelector('button.right');
|
|
62
|
-
|
|
62
|
+
|
|
63
|
+
await waitFor(() => {
|
|
64
|
+
const dots = container.querySelector('div.pagination');
|
|
65
|
+
expect(dots).toBeTruthy();
|
|
66
|
+
});
|
|
67
|
+
|
|
63
68
|
const content = container.querySelector('div.sliderContent');
|
|
64
69
|
|
|
65
70
|
expect(prev).toBeTruthy();
|
|
66
71
|
expect(next).toBeTruthy();
|
|
67
|
-
expect(dots).toBeTruthy();
|
|
68
72
|
expect(content).toBeTruthy();
|
|
69
73
|
expect(content.querySelector('.active>div').innerHTML).toBe('Summer');
|
|
70
74
|
});
|
|
@@ -74,15 +78,15 @@ describe('Slider Component', () => {
|
|
|
74
78
|
|
|
75
79
|
const { container } = render(
|
|
76
80
|
<Slider>
|
|
77
|
-
{list.map((element) =>
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
{list.map((element) => (
|
|
82
|
+
<div key={keygen()}>{element}</div>
|
|
83
|
+
))}
|
|
80
84
|
</Slider>
|
|
81
85
|
);
|
|
82
86
|
|
|
83
87
|
const prev = container.querySelector('button.left');
|
|
84
88
|
const next = container.querySelector('button.right');
|
|
85
|
-
|
|
89
|
+
|
|
86
90
|
const content = container.querySelector('div.sliderContent');
|
|
87
91
|
|
|
88
92
|
fireEvent.click(next);
|
|
@@ -91,10 +95,13 @@ describe('Slider Component', () => {
|
|
|
91
95
|
fireEvent.click(prev);
|
|
92
96
|
expect(content.querySelector('.active>div').innerHTML).toBe('Summer');
|
|
93
97
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
await waitFor(() => {
|
|
99
|
+
const dots = container.querySelector('div.pagination');
|
|
100
|
+
const dot = dots.querySelectorAll('button');
|
|
101
|
+
expect(dot.length).toEqual(4);
|
|
102
|
+
fireEvent.click(dot[1]);
|
|
103
|
+
expect(content.querySelector('.active>div').innerHTML).toBe('Autumn');
|
|
104
|
+
});
|
|
98
105
|
});
|
|
99
106
|
|
|
100
107
|
test('Swipe Slides', async () => {
|
|
@@ -102,9 +109,9 @@ describe('Slider Component', () => {
|
|
|
102
109
|
act(() => {
|
|
103
110
|
const { container } = render(
|
|
104
111
|
<Slider>
|
|
105
|
-
{list.map((element) =>
|
|
106
|
-
|
|
107
|
-
|
|
112
|
+
{list.map((element) => (
|
|
113
|
+
<div key={keygen()}>{element}</div>
|
|
114
|
+
))}
|
|
108
115
|
</Slider>
|
|
109
116
|
);
|
|
110
117
|
|