gatsby-matrix-theme 5.0.4 → 5.0.7

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 (38) hide show
  1. package/.ci.yml +5 -3
  2. package/CHANGELOG.md +45 -0
  3. package/package.json +2 -2
  4. package/src/components/atoms/cards/popup-card/index.js +26 -10
  5. package/src/components/atoms/cards/popup-card/popup-card.module.scss +63 -50
  6. package/src/components/organisms/popup/index.js +49 -24
  7. package/src/components/organisms/popup/popup.module.scss +203 -65
  8. package/src/constants/months.js +14 -0
  9. package/src/gatsby-core-theme/components/atoms/spotlights/spotlights-theme.module.scss +3 -10
  10. package/src/gatsby-core-theme/components/pages/body/index.js +5 -2
  11. package/src/gatsby-core-theme/styles/utils/variables/_main.scss +9 -0
  12. package/static/images/popup-bg.webp +0 -0
  13. package/storybook/public/{0.32207731.iframe.bundle.js → 0.6cfc4d94.iframe.bundle.js} +1 -1
  14. package/storybook/public/{1.4a7636d8.iframe.bundle.js → 1.3b5c0fbd.iframe.bundle.js} +1 -1
  15. package/storybook/public/{10.2522d665.iframe.bundle.js → 10.3c98d624.iframe.bundle.js} +1 -1
  16. package/storybook/public/{11.188b4e9c.iframe.bundle.js → 11.72c07fc6.iframe.bundle.js} +1 -1
  17. package/storybook/public/{12.dc60f46f.iframe.bundle.js → 12.317655aa.iframe.bundle.js} +1 -1
  18. package/storybook/public/{5.69290c4d.iframe.bundle.js → 5.6e16d403.iframe.bundle.js} +3 -3
  19. package/storybook/public/{5.69290c4d.iframe.bundle.js.LICENSE.txt → 5.6e16d403.iframe.bundle.js.LICENSE.txt} +0 -0
  20. package/storybook/public/5.6e16d403.iframe.bundle.js.map +1 -0
  21. package/storybook/public/{6.ba83325a.iframe.bundle.js → 6.6ccf906e.iframe.bundle.js} +1 -1
  22. package/storybook/public/{7.dbd57ff4.iframe.bundle.js → 7.2d825c7c.iframe.bundle.js} +1 -1
  23. package/storybook/public/{8.deb9a974.iframe.bundle.js → 8.66a653e4.iframe.bundle.js} +1 -1
  24. package/storybook/public/{9.2587f8b2.iframe.bundle.js → 9.f600359d.iframe.bundle.js} +3 -3
  25. package/storybook/public/{9.2587f8b2.iframe.bundle.js.LICENSE.txt → 9.f600359d.iframe.bundle.js.LICENSE.txt} +0 -0
  26. package/storybook/public/9.f600359d.iframe.bundle.js.map +1 -0
  27. package/storybook/public/iframe.html +1 -1
  28. package/storybook/public/main.2f8045cb.iframe.bundle.js +1 -0
  29. package/storybook/public/{runtime~main.bd9b5a98.iframe.bundle.js → runtime~main.35ce2f7e.iframe.bundle.js} +1 -1
  30. package/storybook/public/static/media/popup-bg.51d14d2d.webp +0 -0
  31. package/storybook/public/vendors~main.0dce1627.iframe.bundle.js +7 -0
  32. package/storybook/public/{vendors~main.ef7c10f2.iframe.bundle.js.LICENSE.txt → vendors~main.0dce1627.iframe.bundle.js.LICENSE.txt} +0 -0
  33. package/storybook/public/vendors~main.0dce1627.iframe.bundle.js.map +1 -0
  34. package/storybook/public/5.69290c4d.iframe.bundle.js.map +0 -1
  35. package/storybook/public/9.2587f8b2.iframe.bundle.js.map +0 -1
  36. package/storybook/public/main.9d455659.iframe.bundle.js +0 -1
  37. package/storybook/public/vendors~main.ef7c10f2.iframe.bundle.js +0 -7
  38. package/storybook/public/vendors~main.ef7c10f2.iframe.bundle.js.map +0 -1
package/.ci.yml CHANGED
@@ -16,6 +16,9 @@ Matrix Theme Test:
16
16
  - yarn config set cache-folder .yarn
17
17
  - yarn
18
18
  - yarn workspace gatsby-matrix-theme test
19
+ artifacts:
20
+ paths:
21
+ - coverage/
19
22
  coverage: /All files\s*\|\s*([\d\.]+)/
20
23
  rules:
21
24
  - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
@@ -36,8 +39,7 @@ Theme Publish:
36
39
  - cd matrix-theme/
37
40
  - yarn
38
41
  - npx semantic-release -b $CI_COMMIT_REF_NAME
39
- when:
40
- manual
42
+ when: manual
41
43
  only:
42
44
  refs:
43
45
  - master
@@ -45,4 +47,4 @@ Theme Publish:
45
47
  - $PIPELINE != "content-trigger"
46
48
 
47
49
  variables:
48
- PIPELINE: automated
50
+ PIPELINE: automated
package/CHANGELOG.md CHANGED
@@ -1,3 +1,48 @@
1
+ ## [5.0.7](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v5.0.6...v5.0.7) (2022-03-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update theme version ([93021b7](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/93021b744577e5b0bb0980368219539b2f82fbf5))
7
+
8
+ ## [5.0.6](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v5.0.5...v5.0.6) (2022-03-10)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * lighthouse pipeline ([e4086ba](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e4086ba67d73a1bab6c0c32eaadfceecd438a8f5))
14
+ * popup styling ([d8533b2](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/d8533b2661f71abe80177b0d7357f585213106a0))
15
+ * spotlight boxes with icons = style ([ba7914a](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/ba7914a4558401350ebe0934d87acc70ad017d7d))
16
+ * spotlight styling ([c852440](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/c852440d4b902ff2a08ce8b7941737a7f7085e68))
17
+
18
+
19
+ * Merge branch 'tm-2758-lighthouse' into 'master' ([8d1cc38](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/8d1cc3824e067a3c55b8f9c8dcc85c5eee381350))
20
+ * Merge branch 'master' of https://git.ilcd.rocks/team-floyd/themes/matrix-theme ([1fea267](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/1fea267f3b6a02b5d78a7d1cea1af91cee4866b9))
21
+ * Merge branch 'tm-2767-fix-boxes-icons' into 'master' ([e7a573e](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e7a573edbabbe9047699782c58789f2b340413f1))
22
+
23
+ ## [5.0.5](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v5.0.4...v5.0.5) (2022-03-09)
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * add colors ([107f82b](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/107f82bc88f3fc5f34751dc058df6f9b882dd2c6))
29
+ * add excludeTemplateInPopup prop on popup ([7983069](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/79830691468af802f660bef22ce07b38ab329dfa))
30
+ * add make style and replace word month with current month ([e18de59](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e18de59e12447bcb75bd946bea4cfab628659ce0))
31
+ * add props for title and buttonText ([ed833d9](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/ed833d9d17588024cfaeed9910178b4c8cef8d42))
32
+ * change structure and add some others fields ([1d415ce](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/1d415ceebf210e86ce21ea2482ed794a4e83538c))
33
+ * fix conflicts ([53b31db](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/53b31dbb2684f2d855bd32c6ae715039e02764f5))
34
+ * moved the img in the static folder ([e8899f4](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e8899f4375a8bc1282718d63a9fa4aec7a53370d))
35
+ * name and tnc default false ([66ed72f](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/66ed72f08220d6d603baf9ae1f6a398ff0bfabed))
36
+
37
+
38
+ ### Config
39
+
40
+ * updated core theme ([6a6c533](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/6a6c533d562898cf3843069a4529b597d1f685d0))
41
+
42
+
43
+ * Merge branch 'tm-2674-il-popup' into 'master' ([33782fa](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/33782fa9a48fb1bc64a22f97fc75fc0cdb18afc8))
44
+ * Merge branch 'master' into tm-2674-il-popup ([1e33c6f](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/1e33c6fbd0b4ebc8f0647b5bdca6b48fdb486429))
45
+
1
46
  ## [5.0.4](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v5.0.3...v5.0.4) (2022-03-08)
2
47
 
3
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-matrix-theme",
3
- "version": "5.0.4",
3
+ "version": "5.0.7",
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.1.0",
34
+ "gatsby-core-theme": "^5.1.2",
35
35
  "gatsby-image": "^3.3.0",
36
36
  "gatsby-plugin-image": "^1.3.1",
37
37
  "gatsby-plugin-postcss": "^4.3.0",
@@ -2,14 +2,17 @@ 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';
6
+ import StarRating from 'gatsby-core-theme/src/components/molecules/star-rating';
5
7
  import LazyImage from '~hooks/lazy-image';
6
8
 
7
9
  import styles from './popup-card.module.scss';
8
10
 
9
- const PopupCard = ({ item, tracker }) => {
10
- const { logo_url: logoUrl } = item;
11
+ const PopupCard = ({ item, tracker, showName = false, showTnc = false, showRating = false }) => {
12
+ const { logo_url: logoUrl, name } = item;
11
13
  const oneLiner = item?.one_liners?.main?.one_liner;
12
14
  const secondLiner = item?.one_liners?.secondary?.one_liner;
15
+ const tnc = item?.extra_fields?.terms_and_conditions_text_enabled;
13
16
  const [one, second] = (oneLiner?.includes('+') && oneLiner?.split('+')) || [
14
17
  oneLiner,
15
18
  secondLiner,
@@ -17,14 +20,14 @@ const PopupCard = ({ item, tracker }) => {
17
20
 
18
21
  return (
19
22
  <div className={styles.popupCard}>
20
- <div className={styles.wrapper}>
21
- <div className={styles.imgContainer}>
22
- <LazyImage src={imagePrettyUrl(logoUrl)} alt={oneLiner} width={98} height={98} />
23
- </div>
24
- <div className={styles.textContainer}>
25
- <p className={styles.primaryText}>{one}</p>
26
- <p className={styles.secondaryText}>{`+${second}`}</p>
27
- </div>
23
+ <div className={styles.imgContainer}>
24
+ <LazyImage src={imagePrettyUrl(logoUrl)} alt={oneLiner} width={98} height={98} />
25
+ {showRating && <StarRating numOfStars={5} rating={item?.rating} />}
26
+ {showName && <p className={styles.name}>{name}</p>}
27
+ </div>
28
+ <div className={styles.textContainer}>
29
+ <p className={styles.primaryText}>{one}</p>
30
+ <p className={styles.secondaryText}>{`+${second}`}</p>
28
31
  </div>
29
32
  <div className={styles.buttonContainer}>
30
33
  <OperatorCta
@@ -34,15 +37,25 @@ const PopupCard = ({ item, tracker }) => {
34
37
  gtmClass="popup-operator-cta-gtm"
35
38
  />
36
39
  </div>
40
+ {showTnc && tnc === '1' && (
41
+ <div className={styles.tandc}>
42
+ <Tnc onlyMobile operator={item} />
43
+ </div>
44
+ )}
37
45
  </div>
38
46
  );
39
47
  };
40
48
 
41
49
  PopupCard.propTypes = {
42
50
  item: PropTypes.shape({
51
+ name: PropTypes.string,
43
52
  links: PropTypes.shape({
44
53
  main: PropTypes.string,
45
54
  }),
55
+ rating: PropTypes.string,
56
+ extra_fields: PropTypes.shape({
57
+ terms_and_conditions_text_enabled: PropTypes.string,
58
+ }),
46
59
  logo_url: PropTypes.string,
47
60
  one_liners: PropTypes.shape({
48
61
  main: PropTypes.shape({
@@ -54,6 +67,9 @@ PopupCard.propTypes = {
54
67
  }),
55
68
  }),
56
69
  tracker: PropTypes.string,
70
+ showName: PropTypes.bool,
71
+ showTnc: PropTypes.bool,
72
+ showRating: PropTypes.bool,
57
73
  };
58
74
 
59
75
  export default PopupCard;
@@ -1,8 +1,6 @@
1
1
  .popupCard {
2
- display: flex;
3
- flex-direction: column;
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,73 @@
11
9
  padding: 16px 0;
12
10
  }
13
11
 
14
- .wrapper {
15
- height: 100%;
16
- display: flex;
12
+ @include max(tablet) {
13
+ width: 100%;
14
+ }
15
+
16
+ .imgContainer {
17
+ width: 8rem;
18
+ min-width: 8rem;
19
+ grid-column: 1/2;
20
+ grid-row: 1/2;
21
+ @include flex-direction(column);
22
+ @include flex-align(center, center);
17
23
 
18
- @include max(tablet) {
24
+ @include min(tablet) {
25
+ min-width: 9.8rem;
26
+ width: 9.8rem;
27
+ height: 9.8rem;
28
+ }
29
+
30
+ > img {
19
31
  width: 100%;
32
+ height: 100%;
33
+ border-radius: 0.4rem;
34
+ object-fit: contain;
20
35
  }
36
+ }
37
+ .tandc{
38
+ grid-row: 3/4;
39
+ grid-column: 1/3;
40
+ margin-bottom: 2rem;
41
+ }
42
+ .textContainer {
43
+ display: flex;
44
+ flex-direction: column;
45
+ justify-content: center;
46
+ grid-column: 2/3;
47
+ grid-row: 1/2;
48
+ margin-left: 1.5rem;
21
49
 
22
- .imgContainer {
23
- width: 8rem;
24
- height: 8rem;
25
- min-width: 8rem;
50
+ .primaryText {
51
+ color: #e00028;
52
+ font-weight: 700;
53
+ font-size: 1.4rem;
54
+ line-height: 2.3rem;
26
55
 
27
56
  @include min(tablet) {
28
- min-width: 9.8rem;
29
- width: 9.8rem;
30
- height: 9.8rem;
31
- }
32
-
33
- > img {
34
- width: 100%;
35
- height: 100%;
36
- border-radius: 0.4rem;
37
- object-fit: contain;
57
+ font-size: 2rem;
58
+ line-height: 3rem;
38
59
  }
39
60
  }
40
61
 
41
- .textContainer {
42
- display: flex;
43
- flex-direction: column;
44
- justify-content: center;
45
- margin-left: 1.5rem;
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;
62
+ .secondaryText {
63
+ color: #17182f;
64
+ font-weight: 700;
65
+ line-height: 2.3rem;
66
+ font-size: 1.4rem;
64
67
 
65
- @include min(tablet) {
66
- line-height: 3rem;
67
- font-size: 1.8rem;
68
- }
68
+ @include min(tablet) {
69
+ line-height: 3rem;
70
+ font-size: 1.8rem;
69
71
  }
70
72
  }
73
+
71
74
  }
72
-
73
75
  .buttonContainer {
74
76
  margin-left: 3rem;
77
+ grid-column: 1/3;
78
+ grid-row: 2/3;
75
79
 
76
80
  @include max(mobile) {
77
81
  width: 100%;
@@ -88,4 +92,13 @@
88
92
  font-size: 1.8rem;
89
93
  }
90
94
  }
95
+ @include min(tablet){
96
+ grid-template-columns: 9.8rem 2fr 1.5fr;
97
+ .buttonContainer {
98
+ @include flex-direction(row);
99
+ @include flex-align(center, end);
100
+ grid-column: 3/4;
101
+ grid-row: 1/2;
102
+ }
103
+ }
91
104
  }
@@ -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 close = () => {
29
- setShowModal(false);
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
- close();
56
+ setShowModal(false);
51
57
  }
52
58
  };
53
59
 
54
60
  const handleOutsideClick = (event) => {
55
- if (
56
- modal.current &&
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 className={`${styles.modalInner} ${style && styles[style]}`} ref={modal}>
93
- <div className={styles.modalOverlay} onClick={close}>
94
- <div className={styles.popupCenter}>
95
- <div className={styles.modalContent}>
96
- <div className={styles.modalTitle}>
97
- <p>{translate(translations, 'claim_bonuses', 'Claim These Exclusive Bonuses')}</p>
98
- <button className={`${styles.closeIcon} popup-gtm btn-cta`} onClick={close}>
99
- <MdClose />
100
- </button>
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
- {shownItems?.map((item, index) => (
103
- // eslint-disable-next-line react/no-array-index-key
104
- <PopupCard key={index} item={item} tracker={tracker} />
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;