gatsby-matrix-theme 5.0.2 → 5.0.5
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 +45 -0
- package/package.json +2 -2
- package/src/components/atoms/cards/comparison-table/table/index.js +7 -8
- package/src/components/atoms/cards/comparison-table/table/table.test.js +1 -0
- package/src/components/atoms/cards/popup-card/index.js +20 -10
- package/src/components/atoms/cards/popup-card/popup-card.module.scss +56 -50
- package/src/components/atoms/social-icons/index.js +18 -19
- package/src/components/atoms/social-icons/social-icons.module.scss +1 -1
- package/src/components/organisms/popup/index.js +49 -24
- package/src/components/organisms/popup/popup.module.scss +203 -65
- package/src/constants/months.js +14 -0
- package/src/gatsby-core-theme/components/molecules/header/header.test.js +0 -3
- package/src/gatsby-core-theme/components/pages/body/index.js +5 -2
- package/src/gatsby-core-theme/styles/utils/variables/_main.scss +9 -0
- package/static/images/popup-bg.webp +0 -0
- package/storybook/public/{0.400d2cc7.iframe.bundle.js → 0.71431a30.iframe.bundle.js} +1 -1
- package/storybook/public/{1.2a2b1ee2.iframe.bundle.js → 1.3b5c0fbd.iframe.bundle.js} +1 -1
- package/storybook/public/{10.2522d665.iframe.bundle.js → 10.3c98d624.iframe.bundle.js} +1 -1
- package/storybook/public/{11.188b4e9c.iframe.bundle.js → 11.72c07fc6.iframe.bundle.js} +1 -1
- package/storybook/public/{12.dc60f46f.iframe.bundle.js → 12.317655aa.iframe.bundle.js} +1 -1
- package/storybook/public/{5.69290c4d.iframe.bundle.js → 5.e2943b9c.iframe.bundle.js} +3 -3
- package/storybook/public/{5.69290c4d.iframe.bundle.js.LICENSE.txt → 5.e2943b9c.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook/public/5.e2943b9c.iframe.bundle.js.map +1 -0
- package/storybook/public/{6.f9ecbc78.iframe.bundle.js → 6.d4cc1530.iframe.bundle.js} +1 -1
- package/storybook/public/{7.dbd57ff4.iframe.bundle.js → 7.976ee0f8.iframe.bundle.js} +1 -1
- package/storybook/public/{8.deb9a974.iframe.bundle.js → 8.66a653e4.iframe.bundle.js} +1 -1
- package/storybook/public/{9.16798c74.iframe.bundle.js → 9.cdca991d.iframe.bundle.js} +3 -3
- package/storybook/public/{9.16798c74.iframe.bundle.js.LICENSE.txt → 9.cdca991d.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook/public/9.cdca991d.iframe.bundle.js.map +1 -0
- package/storybook/public/iframe.html +1 -1
- package/storybook/public/main.c5b7073f.iframe.bundle.js +1 -0
- package/storybook/public/{runtime~main.49c0e350.iframe.bundle.js → runtime~main.57e18f63.iframe.bundle.js} +1 -1
- package/storybook/public/static/media/popup-bg.51d14d2d.webp +0 -0
- package/storybook/public/vendors~main.f44ae4bf.iframe.bundle.js +7 -0
- package/storybook/public/{vendors~main.8dd0e863.iframe.bundle.js.LICENSE.txt → vendors~main.f44ae4bf.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook/public/vendors~main.f44ae4bf.iframe.bundle.js.map +1 -0
- package/storybook/public/5.69290c4d.iframe.bundle.js.map +0 -1
- package/storybook/public/9.16798c74.iframe.bundle.js.map +0 -1
- package/storybook/public/main.f82095a3.iframe.bundle.js +0 -1
- package/storybook/public/vendors~main.8dd0e863.iframe.bundle.js +0 -7
- package/storybook/public/vendors~main.8dd0e863.iframe.bundle.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
+
## [5.0.5](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v5.0.4...v5.0.5) (2022-03-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add colors ([107f82b](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/107f82bc88f3fc5f34751dc058df6f9b882dd2c6))
|
|
7
|
+
* add excludeTemplateInPopup prop on popup ([7983069](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/79830691468af802f660bef22ce07b38ab329dfa))
|
|
8
|
+
* add make style and replace word month with current month ([e18de59](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e18de59e12447bcb75bd946bea4cfab628659ce0))
|
|
9
|
+
* add props for title and buttonText ([ed833d9](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/ed833d9d17588024cfaeed9910178b4c8cef8d42))
|
|
10
|
+
* change structure and add some others fields ([1d415ce](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/1d415ceebf210e86ce21ea2482ed794a4e83538c))
|
|
11
|
+
* fix conflicts ([53b31db](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/53b31dbb2684f2d855bd32c6ae715039e02764f5))
|
|
12
|
+
* moved the img in the static folder ([e8899f4](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e8899f4375a8bc1282718d63a9fa4aec7a53370d))
|
|
13
|
+
* name and tnc default false ([66ed72f](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/66ed72f08220d6d603baf9ae1f6a398ff0bfabed))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Config
|
|
17
|
+
|
|
18
|
+
* updated core theme ([6a6c533](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/6a6c533d562898cf3843069a4529b597d1f685d0))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
* Merge branch 'tm-2674-il-popup' into 'master' ([33782fa](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/33782fa9a48fb1bc64a22f97fc75fc0cdb18afc8))
|
|
22
|
+
* Merge branch 'master' into tm-2674-il-popup ([1e33c6f](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/1e33c6fbd0b4ebc8f0647b5bdca6b48fdb486429))
|
|
23
|
+
|
|
24
|
+
## [5.0.4](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v5.0.3...v5.0.4) (2022-03-08)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* tests and social links component ([c8a45c6](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/c8a45c6f29f5002528d181bf7541a82c1ac479a7))
|
|
30
|
+
* tests and social links component ([e07a901](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e07a901dba7c4130411e1b6647863aed7cd7cbcb))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
* Merge branch 'tm-2748-social-links' into 'master' ([71c8a4d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/71c8a4d20b1edfb3998bd74e132bac46e13a53b0))
|
|
34
|
+
|
|
35
|
+
## [5.0.3](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v5.0.2...v5.0.3) (2022-03-04)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* disabled lighthouse ci ([d7441fd](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/d7441fdf0436830cd7b9ccedd825ec05ac38b91a))
|
|
41
|
+
* updated core theme version ([bcd29f1](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/bcd29f1fd79b72f16f80cda24cf66c8e4c052999))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
* Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/matrix-theme ([9588ad3](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/9588ad383c36d88df71811eccc348f1092b5e211))
|
|
45
|
+
|
|
1
46
|
## [5.0.2](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v5.0.1...v5.0.2) (2022-03-02)
|
|
2
47
|
|
|
3
48
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gatsby-matrix-theme",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.5",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"description": "Matrix Theme NPM Package",
|
|
6
6
|
"author": "",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"cross-env": "^7.0.2",
|
|
32
32
|
"dotenv": "8.2.0",
|
|
33
33
|
"gatsby": "^3.3.1",
|
|
34
|
-
"gatsby-core-theme": "^5.
|
|
34
|
+
"gatsby-core-theme": "^5.1.1",
|
|
35
35
|
"gatsby-image": "^3.3.0",
|
|
36
36
|
"gatsby-plugin-image": "^1.3.1",
|
|
37
37
|
"gatsby-plugin-postcss": "^4.3.0",
|
|
@@ -128,14 +128,13 @@ export default function ComparisonTable({ items, tabelInfo = listHeadings, ctaKe
|
|
|
128
128
|
const itemsLength = list.length === 6 ? 6 : 5;
|
|
129
129
|
if (i < (showAllPayment.includes(index) ? list.length : itemsLength)) {
|
|
130
130
|
return (
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
</span>
|
|
131
|
+
<LazyImg
|
|
132
|
+
key={`${key}-${deposit.name}`}
|
|
133
|
+
src={imagePrettyUrl(deposit?.logo_filename)}
|
|
134
|
+
width={72}
|
|
135
|
+
height={72}
|
|
136
|
+
alt={deposit.name}
|
|
137
|
+
/>
|
|
139
138
|
);
|
|
140
139
|
}
|
|
141
140
|
})}
|
|
@@ -20,6 +20,7 @@ describe('Comparison table test component', () => {
|
|
|
20
20
|
const loadMoreBtn = paymentMethods.querySelector('a');
|
|
21
21
|
// eslint-disable-next-line no-unused-expressions
|
|
22
22
|
loadMoreBtn && expect(paymentMethods.querySelectorAll('span').length).toEqual(5);
|
|
23
|
+
|
|
23
24
|
loadMoreBtn && fireEvent.click(loadMoreBtn);
|
|
24
25
|
loadMoreBtn && expect(paymentMethods.querySelectorAll('span').length).toBeGreaterThan(5);
|
|
25
26
|
});
|
|
@@ -2,14 +2,16 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import OperatorCta from 'gatsby-core-theme/src/components/atoms/operator-cta';
|
|
4
4
|
import { imagePrettyUrl } from 'gatsby-core-theme/src/helpers/getters';
|
|
5
|
+
import Tnc from 'gatsby-core-theme/src/components/molecules/tnc';
|
|
5
6
|
import LazyImage from '~hooks/lazy-image';
|
|
6
7
|
|
|
7
8
|
import styles from './popup-card.module.scss';
|
|
8
9
|
|
|
9
|
-
const PopupCard = ({ item, tracker }) => {
|
|
10
|
-
const { logo_url: logoUrl } = item;
|
|
10
|
+
const PopupCard = ({ item, tracker, showName = false, showTnc = false }) => {
|
|
11
|
+
const { logo_url: logoUrl, name } = item;
|
|
11
12
|
const oneLiner = item?.one_liners?.main?.one_liner;
|
|
12
13
|
const secondLiner = item?.one_liners?.secondary?.one_liner;
|
|
14
|
+
const tnc = item?.extra_fields?.terms_and_conditions_text_enabled;
|
|
13
15
|
const [one, second] = (oneLiner?.includes('+') && oneLiner?.split('+')) || [
|
|
14
16
|
oneLiner,
|
|
15
17
|
secondLiner,
|
|
@@ -17,14 +19,13 @@ const PopupCard = ({ item, tracker }) => {
|
|
|
17
19
|
|
|
18
20
|
return (
|
|
19
21
|
<div className={styles.popupCard}>
|
|
20
|
-
<div className={styles.
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
</div>
|
|
22
|
+
<div className={styles.imgContainer}>
|
|
23
|
+
<LazyImage src={imagePrettyUrl(logoUrl)} alt={oneLiner} width={98} height={98} />
|
|
24
|
+
{showName && <p className={styles.name}>{name}</p>}
|
|
25
|
+
</div>
|
|
26
|
+
<div className={styles.textContainer}>
|
|
27
|
+
<p className={styles.primaryText}>{one}</p>
|
|
28
|
+
<p className={styles.secondaryText}>{`+${second}`}</p>
|
|
28
29
|
</div>
|
|
29
30
|
<div className={styles.buttonContainer}>
|
|
30
31
|
<OperatorCta
|
|
@@ -34,15 +35,22 @@ const PopupCard = ({ item, tracker }) => {
|
|
|
34
35
|
gtmClass="popup-operator-cta-gtm"
|
|
35
36
|
/>
|
|
36
37
|
</div>
|
|
38
|
+
<div className={styles.tandc}>
|
|
39
|
+
{showTnc && tnc === '1' && <Tnc onlyMobile operator={item} />}
|
|
40
|
+
</div>
|
|
37
41
|
</div>
|
|
38
42
|
);
|
|
39
43
|
};
|
|
40
44
|
|
|
41
45
|
PopupCard.propTypes = {
|
|
42
46
|
item: PropTypes.shape({
|
|
47
|
+
name: PropTypes.string,
|
|
43
48
|
links: PropTypes.shape({
|
|
44
49
|
main: PropTypes.string,
|
|
45
50
|
}),
|
|
51
|
+
extra_fields: PropTypes.shape({
|
|
52
|
+
terms_and_conditions_text_enabled: PropTypes.string,
|
|
53
|
+
}),
|
|
46
54
|
logo_url: PropTypes.string,
|
|
47
55
|
one_liners: PropTypes.shape({
|
|
48
56
|
main: PropTypes.shape({
|
|
@@ -54,6 +62,8 @@ PopupCard.propTypes = {
|
|
|
54
62
|
}),
|
|
55
63
|
}),
|
|
56
64
|
tracker: PropTypes.string,
|
|
65
|
+
showName: PropTypes.bool,
|
|
66
|
+
showTnc: PropTypes.bool,
|
|
57
67
|
};
|
|
58
68
|
|
|
59
69
|
export default PopupCard;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
.popupCard {
|
|
2
|
-
display:
|
|
3
|
-
|
|
4
|
-
align-items: center;
|
|
5
|
-
justify-content: space-between;
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: 8rem 2fr;
|
|
6
4
|
padding-top: 16px;
|
|
7
5
|
border-top: 1px solid #a5bcf0;
|
|
8
6
|
|
|
@@ -11,67 +9,66 @@
|
|
|
11
9
|
padding: 16px 0;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
@include max(tablet) {
|
|
13
|
+
width: 100%;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.imgContainer {
|
|
17
|
+
width: 8rem;
|
|
18
|
+
height: 8rem;
|
|
19
|
+
min-width: 8rem;
|
|
20
|
+
grid-column: 1/2;
|
|
21
|
+
grid-row: 1/2;
|
|
22
|
+
|
|
23
|
+
@include min(tablet) {
|
|
24
|
+
min-width: 9.8rem;
|
|
25
|
+
width: 9.8rem;
|
|
26
|
+
height: 9.8rem;
|
|
27
|
+
}
|
|
17
28
|
|
|
18
|
-
|
|
29
|
+
> img {
|
|
19
30
|
width: 100%;
|
|
31
|
+
height: 100%;
|
|
32
|
+
border-radius: 0.4rem;
|
|
33
|
+
object-fit: contain;
|
|
20
34
|
}
|
|
35
|
+
}
|
|
36
|
+
.textContainer {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
grid-column: 2/3;
|
|
41
|
+
grid-row: 1/2;
|
|
42
|
+
margin-left: 1.5rem;
|
|
21
43
|
|
|
22
|
-
.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
44
|
+
.primaryText {
|
|
45
|
+
color: #e00028;
|
|
46
|
+
font-weight: 700;
|
|
47
|
+
font-size: 1.4rem;
|
|
48
|
+
line-height: 2.3rem;
|
|
26
49
|
|
|
27
50
|
@include min(tablet) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
height: 9.8rem;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
> img {
|
|
34
|
-
width: 100%;
|
|
35
|
-
height: 100%;
|
|
36
|
-
border-radius: 0.4rem;
|
|
37
|
-
object-fit: contain;
|
|
51
|
+
font-size: 2rem;
|
|
52
|
+
line-height: 3rem;
|
|
38
53
|
}
|
|
39
54
|
}
|
|
40
55
|
|
|
41
|
-
.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
.primaryText {
|
|
48
|
-
color: #e00028;
|
|
49
|
-
font-weight: 700;
|
|
50
|
-
font-size: 1.4rem;
|
|
51
|
-
line-height: 2.3rem;
|
|
52
|
-
|
|
53
|
-
@include min(tablet) {
|
|
54
|
-
font-size: 2rem;
|
|
55
|
-
line-height: 3rem;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.secondaryText {
|
|
60
|
-
color: #17182f;
|
|
61
|
-
font-weight: 700;
|
|
62
|
-
line-height: 2.3rem;
|
|
63
|
-
font-size: 1.4rem;
|
|
56
|
+
.secondaryText {
|
|
57
|
+
color: #17182f;
|
|
58
|
+
font-weight: 700;
|
|
59
|
+
line-height: 2.3rem;
|
|
60
|
+
font-size: 1.4rem;
|
|
64
61
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
62
|
+
@include min(tablet) {
|
|
63
|
+
line-height: 3rem;
|
|
64
|
+
font-size: 1.8rem;
|
|
69
65
|
}
|
|
70
66
|
}
|
|
71
67
|
}
|
|
72
|
-
|
|
73
68
|
.buttonContainer {
|
|
74
69
|
margin-left: 3rem;
|
|
70
|
+
grid-column: 1/3;
|
|
71
|
+
grid-row: 2/3;
|
|
75
72
|
|
|
76
73
|
@include max(mobile) {
|
|
77
74
|
width: 100%;
|
|
@@ -88,4 +85,13 @@
|
|
|
88
85
|
font-size: 1.8rem;
|
|
89
86
|
}
|
|
90
87
|
}
|
|
88
|
+
@include min(tablet){
|
|
89
|
+
grid-template-columns: 9.8rem 2fr 1.5fr;
|
|
90
|
+
.buttonContainer {
|
|
91
|
+
@include flex-direction(row);
|
|
92
|
+
@include flex-align(center, end);
|
|
93
|
+
grid-column: 3/4;
|
|
94
|
+
grid-row: 1/2;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
91
97
|
}
|
|
@@ -6,29 +6,25 @@ import { Context } from 'gatsby-core-theme/src/context/TranslationsProvider';
|
|
|
6
6
|
import { translate } from '~helpers/getters';
|
|
7
7
|
import styles from './social-icons.module.scss';
|
|
8
8
|
|
|
9
|
-
const SocialIcons = ({
|
|
9
|
+
const SocialIcons = ({
|
|
10
|
+
socialIcons,
|
|
11
|
+
showTitle = true,
|
|
12
|
+
icons = {
|
|
13
|
+
instagram: <FaInstagram />,
|
|
14
|
+
facebook: <FaFacebookSquare />,
|
|
15
|
+
twitter: <FaTwitter />,
|
|
16
|
+
linkedin: <FaLinkedin />,
|
|
17
|
+
youtube: <FaYoutube />,
|
|
18
|
+
},
|
|
19
|
+
}) => {
|
|
10
20
|
const { translations } = useContext(Context) || {};
|
|
11
21
|
const keys = Object.keys(socialIcons);
|
|
12
|
-
const switchIcons = (icons) => {
|
|
13
|
-
switch (icons) {
|
|
14
|
-
case 'instagram':
|
|
15
|
-
return <FaInstagram />;
|
|
16
|
-
case 'facebook':
|
|
17
|
-
return <FaFacebookSquare />;
|
|
18
|
-
case 'twitter':
|
|
19
|
-
return <FaTwitter />;
|
|
20
|
-
case 'linkedin':
|
|
21
|
-
return <FaLinkedin />;
|
|
22
|
-
case 'youtube':
|
|
23
|
-
return <FaYoutube />;
|
|
24
|
-
default:
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
22
|
|
|
29
23
|
return (
|
|
30
24
|
<div className={styles.container}>
|
|
31
|
-
|
|
25
|
+
{showTitle && (
|
|
26
|
+
<div className={styles.title}>{translate(translations, 'follow_us', 'Follow Us')}</div>
|
|
27
|
+
)}
|
|
32
28
|
<div className={styles.socialIcons}>
|
|
33
29
|
{keys.map(
|
|
34
30
|
(key) =>
|
|
@@ -40,7 +36,7 @@ const SocialIcons = ({ socialIcons }) => {
|
|
|
40
36
|
target="_blank"
|
|
41
37
|
rel="noreferrer"
|
|
42
38
|
>
|
|
43
|
-
{
|
|
39
|
+
{icons[key]}
|
|
44
40
|
</a>
|
|
45
41
|
)
|
|
46
42
|
)}
|
|
@@ -53,4 +49,7 @@ export default SocialIcons;
|
|
|
53
49
|
|
|
54
50
|
SocialIcons.propTypes = {
|
|
55
51
|
socialIcons: PropTypes.shape({}),
|
|
52
|
+
showTitle: PropTypes.bool,
|
|
53
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
54
|
+
icons: PropTypes.object,
|
|
56
55
|
};
|
|
@@ -10,13 +10,13 @@ import { MdClose } from 'react-icons/md';
|
|
|
10
10
|
import { translate } from 'gatsby-core-theme/src/helpers/getters';
|
|
11
11
|
import { Context } from 'gatsby-core-theme/src/context/TranslationsProvider';
|
|
12
12
|
import PopupCard from '../../atoms/cards/popup-card';
|
|
13
|
-
|
|
14
13
|
import { setIdleTimeout } from '../../../helpers/popup';
|
|
15
14
|
import { isMobileDevice } from '../../../helpers/mobile-detect';
|
|
15
|
+
import months from '../../../constants/months';
|
|
16
16
|
|
|
17
17
|
import styles from './popup.module.scss';
|
|
18
18
|
|
|
19
|
-
const Popup = ({ module, isStorybook = false }) => {
|
|
19
|
+
const Popup = ({ module, isStorybook = false, toggle = false, icon = null }) => {
|
|
20
20
|
const modal = useRef(null);
|
|
21
21
|
const [showModal, setShowModal] = useState(false);
|
|
22
22
|
const { items } = module.items[0];
|
|
@@ -24,9 +24,15 @@ const Popup = ({ module, isStorybook = false }) => {
|
|
|
24
24
|
const { style } = module;
|
|
25
25
|
const tracker = isMobileDevice() ? 'mobPopup' : 'Popup';
|
|
26
26
|
const { translations } = useContext(Context) || {};
|
|
27
|
+
const date = new Date();
|
|
28
|
+
const month = months[date.getMonth()];
|
|
29
|
+
const title = translate(translations, 'popupTitle', 'Claim These Exclusive Bonuses').replace(
|
|
30
|
+
'month',
|
|
31
|
+
month
|
|
32
|
+
);
|
|
27
33
|
|
|
28
|
-
const
|
|
29
|
-
setShowModal(
|
|
34
|
+
const handelActive = (status) => {
|
|
35
|
+
setShowModal(status);
|
|
30
36
|
};
|
|
31
37
|
|
|
32
38
|
const idleTimeout = () => {
|
|
@@ -47,17 +53,13 @@ const Popup = ({ module, isStorybook = false }) => {
|
|
|
47
53
|
|
|
48
54
|
const handleEsc = (event) => {
|
|
49
55
|
if (event.keyCode === 27) {
|
|
50
|
-
|
|
56
|
+
setShowModal(false);
|
|
51
57
|
}
|
|
52
58
|
};
|
|
53
59
|
|
|
54
60
|
const handleOutsideClick = (event) => {
|
|
55
|
-
if (
|
|
56
|
-
|
|
57
|
-
!modal.current.contains(event.target) &&
|
|
58
|
-
!modal.current.previousElementSibling.contains(event.target)
|
|
59
|
-
) {
|
|
60
|
-
close();
|
|
61
|
+
if (modal.current && modal?.current === event.target) {
|
|
62
|
+
setShowModal(false);
|
|
61
63
|
}
|
|
62
64
|
};
|
|
63
65
|
|
|
@@ -89,20 +91,41 @@ const Popup = ({ module, isStorybook = false }) => {
|
|
|
89
91
|
}, []);
|
|
90
92
|
|
|
91
93
|
return (
|
|
92
|
-
<div
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
<div
|
|
95
|
+
className={`${styles.popup} ${toggle ? styles.toggleButton : styles.defaultPopup} ${
|
|
96
|
+
style && styles[style]
|
|
97
|
+
}`}
|
|
98
|
+
>
|
|
99
|
+
{showModal && <div onClick={() => handelActive(false)} className={styles.modalOverlay} />}
|
|
100
|
+
<div className={`${styles.modalInner} `} ref={modal}>
|
|
101
|
+
<div className={styles.itemsContent}>
|
|
102
|
+
<div className={styles.popupCenter}>
|
|
103
|
+
<div className={styles.modalContent}>
|
|
104
|
+
<div className={styles.modalTitle}>
|
|
105
|
+
<p>{title}</p>
|
|
106
|
+
<button
|
|
107
|
+
className={`${styles.closeIcon} popup-gtm btn-cta`}
|
|
108
|
+
onClick={() => handelActive(false)}
|
|
109
|
+
>
|
|
110
|
+
<MdClose />
|
|
111
|
+
</button>
|
|
112
|
+
</div>
|
|
113
|
+
{shownItems?.map((item, index) => (
|
|
114
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
115
|
+
<PopupCard key={index} item={item} tracker={tracker} />
|
|
116
|
+
))}
|
|
101
117
|
</div>
|
|
102
|
-
{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
118
|
+
{toggle && (
|
|
119
|
+
<div
|
|
120
|
+
className={styles.toggleButtonPopup}
|
|
121
|
+
onClick={() => {
|
|
122
|
+
handelActive(!showModal);
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
125
|
+
{icon}
|
|
126
|
+
<p>{title}</p>
|
|
127
|
+
</div>
|
|
128
|
+
)}
|
|
106
129
|
</div>
|
|
107
130
|
</div>
|
|
108
131
|
</div>
|
|
@@ -116,6 +139,8 @@ Popup.propTypes = {
|
|
|
116
139
|
style: PropTypes.string,
|
|
117
140
|
}).isRequired,
|
|
118
141
|
isStorybook: PropTypes.bool,
|
|
142
|
+
toggle: PropTypes.bool,
|
|
143
|
+
icon: PropTypes.elementType,
|
|
119
144
|
};
|
|
120
145
|
|
|
121
146
|
export default Popup;
|