gatsby-matrix-theme 23.0.3 → 23.0.4

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 (20) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/package.json +1 -1
  3. package/src/components/atoms/cards/operator-card/template-four/index.js +3 -1
  4. package/src/components/atoms/cards/operator-card/template-one/index.js +3 -1
  5. package/src/components/atoms/cards/operator-card/template-three/index.js +3 -1
  6. package/src/components/atoms/cards/operator-card/template-two/index.js +3 -1
  7. package/src/components/atoms/operator-score-gauge/index.js +0 -12
  8. package/src/components/atoms/operator-score-gauge/operator-score-gauge.module.scss +1 -18
  9. package/src/components/molecules/wagering-calculator/index.js +94 -0
  10. package/src/components/molecules/wagering-calculator/wagering-calculator.module.scss +200 -0
  11. package/src/components/molecules/wagering-calculator/wagering-calculator.stories.js +56 -0
  12. package/src/components/molecules/wagering-calculator/wagering-calculator.test.js +54 -0
  13. package/src/gatsby-core-theme/components/molecules/module/index.js +2 -0
  14. package/src/gatsby-core-theme/styles/utils/variables/_colors.scss +1 -0
  15. package/storybook/public/{522.f6eff369.iframe.bundle.js → 134.f050c17b.iframe.bundle.js} +3 -3
  16. package/storybook/public/{522.f6eff369.iframe.bundle.js.map → 134.f050c17b.iframe.bundle.js.map} +1 -1
  17. package/storybook/public/iframe.html +1 -1
  18. package/storybook/public/main.dc5e99d6.iframe.bundle.js +1 -0
  19. package/storybook/public/main.92859cc5.iframe.bundle.js +0 -1
  20. /package/storybook/public/{522.f6eff369.iframe.bundle.js.LICENSE.txt → 134.f050c17b.iframe.bundle.js.LICENSE.txt} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## [23.0.4](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v23.0.3...v23.0.4) (2023-05-23)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * added results in wagering calculator ([3813c82](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/3813c829cfc71775ea374179bff698ac4751dcd7))
7
+ * operator cards bug ([a4ebaf7](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/a4ebaf75f0c8990876bf009f21fa7e81986235e5))
8
+ * wagering fixes ([1f0579b](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/1f0579b73ca7902db9cbd132f67e7479e28aadd0))
9
+ * welcome bonus ([ed68600](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/ed686003b4c87f0099bfe8991845cfed9b4586c5))
10
+
11
+
12
+ ### Code Refactoring
13
+
14
+ * add wagering calculator into modules ([95eaf0e](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/95eaf0e6da046854c0d0edc8dc7994f094242d70))
15
+ * update matrix theme with wagering calculator ([d39170e](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/d39170e6832854c137b9b8ceddbb14830bd29cec))
16
+ * update wagering calculator with styles ([79db240](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/79db240bc423d23ee65c70dbef70d50a07c73bc9))
17
+
18
+
19
+ * Merge branch 'welcome-bonus' into 'master' ([0003199](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/0003199313c259058d55c9e3d8cf07590682599d))
20
+ * Merge branch 'tm-3094-wagering-calculator' into 'master' ([00500e9](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/00500e9c9890b910b011dc5e4ef0625911ed94f4))
21
+ * Merge branch 'master' into tm-3094-wagering-calculator ([a25c655](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/a25c655f130ae2733401e48ed83dd417cd5288bd))
22
+
1
23
  ## [23.0.3](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v23.0.2...v23.0.3) (2023-05-18)
2
24
 
3
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-matrix-theme",
3
- "version": "23.0.3",
3
+ "version": "23.0.4",
4
4
  "main": "index.js",
5
5
  "description": "Matrix Theme NPM Package",
6
6
  "author": "",
@@ -57,7 +57,9 @@ const TemplateFour = ({
57
57
  src={imagePrettyUrl(relation?.standardised_logo_url_object?.filename, 88, 88)}
58
58
  alt={getAltText(relation?.standardised_logo_url_object, name)}
59
59
  />
60
- {showRibbon && ribbons.length > 0 && <span className={styles.ribbon}>{ribbons[0]}</span>}
60
+ {showRibbon && ribbons && ribbons.length > 0 && (
61
+ <span className={styles.ribbon}>{ribbons[0]}</span>
62
+ )}
61
63
  </Link>
62
64
  <Link to={reviewPath} title={name} className="operator-card-gtm">
63
65
  {name}
@@ -68,7 +68,9 @@ const TemplateOne = ({
68
68
  src={imagePrettyUrl(relation?.standardised_logo_url_object?.filename, 88, 88)}
69
69
  alt={getAltText(relation?.standardised_logo_url_object, name)}
70
70
  />
71
- {showRibbon && ribbons.length > 0 && <span className={styles.ribbon}>{ribbons[0]}</span>}
71
+ {showRibbon && ribbons && ribbons.length > 0 && (
72
+ <span className={styles.ribbon}>{ribbons[0]}</span>
73
+ )}
72
74
  </Link>
73
75
  <Link to={reviewPath} title={name} className="operator-card-gtm">
74
76
  {name}
@@ -56,7 +56,9 @@ const TemplateThree = ({
56
56
  src={imagePrettyUrl(relation?.standardised_logo_url_object?.filename, 88, 88)}
57
57
  alt={getAltText(relation?.standardised_logo_url_object, name)}
58
58
  />
59
- {showRibbon && ribbons.length > 0 && <span className={styles.ribbon}>{ribbons[0]}</span>}
59
+ {showRibbon && ribbons && ribbons.length > 0 && (
60
+ <span className={styles.ribbon}>{ribbons[0]}</span>
61
+ )}
60
62
  </Link>
61
63
  <Link to={reviewPath} title={name} className="operator-card-gtm">
62
64
  {name}
@@ -63,7 +63,9 @@ const TemplateTwo = ({
63
63
  alt={getAltText(relation?.standardised_logo_url_object, name)}
64
64
  />
65
65
  </Link>
66
- {showRibbon && ribbons.length > 0 && <span className={styles.ribbon}>{ribbons[0]}</span>}
66
+ {showRibbon && ribbons && ribbons.length > 0 && (
67
+ <span className={styles.ribbon}>{ribbons[0]}</span>
68
+ )}
67
69
  </div>
68
70
  <div className={styles?.cardContentTop || ''}>
69
71
  <Link to={reviewPath} title={name} className="operator-card-gtm">
@@ -15,18 +15,6 @@ const OperatorScoreGauge = ({ operator, onHeader = false }) => {
15
15
  startGradientColor={onHeader ? '#4ecdc4' : '#ccced9'}
16
16
  endGradientColor={onHeader ? '#1a535c' : '#4ecdc4'}
17
17
  />
18
- <div className={`${styles?.backCircle || ''} ${styles?.textCircle || ''}`}>
19
- <CircleRating
20
- rating={rating}
21
- radius={onHeader ? 150 : 230}
22
- strokeWidth={onHeader ? '22' : '45'}
23
- gradientId={onHeader ? 'diagonal-gradient' : 'white-diagonal'}
24
- backgroundColor={onHeader ? '' : '#082030'}
25
- />
26
- <span className={styles?.ratingText || ''}>
27
- <span>{rating}</span>/10
28
- </span>
29
- </div>
30
18
  <div className={`${styles?.frontCircle || ''} ${styles?.textCircle || ''}`}>
31
19
  <CircleRating
32
20
  rating={rating}
@@ -21,24 +21,7 @@
21
21
  position: absolute;
22
22
  }
23
23
 
24
- .backCircle {
25
- opacity: 0.1;
26
- position: absolute;
27
- display: none;
28
- svg {
29
- height: 50rem;
30
- width: 50rem;
31
-
32
- circle {
33
- cx: 260;
34
- }
35
- }
36
-
37
- .ratingText {
38
- font-size: 10rem;
39
- color: #ccced9;
40
- }
41
- }
24
+
42
25
  .frontCircle {
43
26
  width: 18rem;
44
27
  height: 18rem;
@@ -0,0 +1,94 @@
1
+ /* eslint-disable no-nested-ternary */
2
+ import React, { useState, useContext } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { MdClose } from '@react-icons/all-files/md/MdClose';
5
+ import { AiOutlineQuestionCircle } from '@react-icons/all-files/ai/AiOutlineQuestionCircle';
6
+ import { Context } from 'gatsby-core-theme/src/context/MainProvider';
7
+ import { translate } from 'gatsby-core-theme/src/helpers/getters';
8
+ import Button from 'gatsby-core-theme/src/components/atoms/button';
9
+ import styles from './wagering-calculator.module.scss';
10
+
11
+ const WageringCalculator = ({
12
+ mainTitle = 'Wagering Requirement Calculator',
13
+ infoIcon,
14
+ infoTitle,
15
+ infoText,
16
+ }) => {
17
+ const [isInfoOpen, setIsInfoOpen] = useState(false);
18
+ const [result, setResult] = useState(null);
19
+ const { translations } = useContext(Context);
20
+ const InfoIcon = infoIcon || AiOutlineQuestionCircle;
21
+
22
+ const Calculate = ({ target: { elements } }) => {
23
+ const resultCalc =
24
+ (elements.bonus.value +
25
+ (elements.calc_select.value !== 'bonus' ? elements.deposit.value : 0)) *
26
+ elements.wagering.value *
27
+ (10 / elements.contribution.value);
28
+ setResult(Math.round(resultCalc));
29
+ };
30
+
31
+ return (
32
+ <>
33
+ <form
34
+ className={styles.container}
35
+ onSubmit={Calculate}
36
+ // eslint-disable-next-line
37
+ action="javascript:void(0);"
38
+ target="_self"
39
+ >
40
+ <h2 className={styles.mainTitle}>
41
+ {mainTitle}
42
+ {infoTitle && infoText && <InfoIcon onClick={() => setIsInfoOpen(true)} />}
43
+ </h2>
44
+ <label htmlFor="deposit">
45
+ {translate(translations, 'wagecalc_deposit_amount', 'Deposit amount')}
46
+ </label>
47
+ <input id="deposit" type="number" />
48
+ <label htmlFor="bonus">
49
+ {translate(translations, 'wagecalc_bonus_amount', 'Bonus amount')}
50
+ </label>
51
+ <input id="bonus" type="number" />
52
+ <label htmlFor="wagering">{translate(translations, 'wagecalc_wagering', 'Wagering')}</label>
53
+ <input id="wagering" type="number" />
54
+ <select id="calc_select">
55
+ <option value="bonus">{translate(translations, 'wagecalc_bonus', 'Bonus')}</option>
56
+ <option value="bonus_deposit">
57
+ {translate(translations, 'wagecalc_deposit_bonus', 'Deposit + Bonus')}
58
+ </option>
59
+ </select>
60
+ <label htmlFor="contribution">
61
+ {translate(translations, 'wagecalc_contribution', 'Contribution %')}
62
+ </label>
63
+ <input id="contribution" type="number" max="100" />
64
+ <Button
65
+ isButton
66
+ primaryColor
67
+ btnText={translate(translations, 'wagecalc_calculate', 'Calculate')}
68
+ />
69
+ {isInfoOpen && (
70
+ <div className={styles.container}>
71
+ <h2 className={styles.infoTitle}>{infoTitle}</h2>
72
+ <MdClose onClick={() => setIsInfoOpen(false)} />
73
+ <p>{infoText}</p>
74
+ </div>
75
+ )}
76
+ {result && (
77
+ <div className={styles.resultContainer}>
78
+ <span>{translate(translations, 'wagecalc_result', 'Result')}</span>
79
+ <span>{result}</span>
80
+ </div>
81
+ )}
82
+ </form>
83
+ </>
84
+ );
85
+ };
86
+
87
+ WageringCalculator.propTypes = {
88
+ mainTitle: PropTypes.string,
89
+ infoTitle: PropTypes.string,
90
+ infoText: PropTypes.string,
91
+ infoIcon: PropTypes.element,
92
+ };
93
+
94
+ export default WageringCalculator;
@@ -0,0 +1,200 @@
1
+ .container {
2
+ margin: 0 auto;
3
+ padding: 1.6rem;
4
+ max-width: 34.3rem;
5
+ display: flex;
6
+ flex-direction: column;
7
+ border-radius: 1.2rem;
8
+ box-shadow: 0px -3px 14px rgba(0, 0, 0, 0.09);
9
+ background-color: var(--color-4);
10
+ @include min(tablet) {
11
+ padding: 2.4rem;
12
+ max-width: 96rem;
13
+ }
14
+ }
15
+
16
+ form.container {
17
+ position: relative;
18
+ svg {
19
+ margin-left: 1.2rem;
20
+ height: 2.67rem;
21
+ width: 2.67rem;
22
+ vertical-align: text-bottom;
23
+ }
24
+ button[type='submit'] {
25
+ margin-top: 1.6rem;
26
+ padding: 1.6rem;
27
+ }
28
+ @include min(tablet) {
29
+ display: flex;
30
+ flex-direction: row;
31
+ flex-wrap: wrap;
32
+ justify-content: space-between;
33
+ }
34
+ }
35
+
36
+ div.container {
37
+ height: 100%;
38
+ position: absolute;
39
+ top: 0;
40
+ left: 0;
41
+ z-index: 3;
42
+ svg {
43
+ position: absolute;
44
+ top: 1.99rem;
45
+ right: 1.99rem;
46
+ }
47
+ }
48
+
49
+ .mainTitle {
50
+ line-height: 3.4rem;
51
+ font-size: 2.4rem;
52
+ }
53
+
54
+ .infoTitle {
55
+ font-size: 2rem;
56
+ line-height: 3rem;
57
+ }
58
+
59
+ h2,
60
+ label {
61
+ font-weight: 700;
62
+ text-transform: capitalize;
63
+ color: var(--color-71);
64
+ }
65
+
66
+ h2 {
67
+ margin-top: 0;
68
+ margin-bottom: 2.4rem;
69
+ width: 100%;
70
+ }
71
+
72
+ label {
73
+ line-height: 2.6rem;
74
+ font-size: 1.6rem;
75
+ @include min(tablet) {
76
+ margin-top: 1.6rem;
77
+ }
78
+ }
79
+
80
+ input,
81
+ select {
82
+ padding: 16px;
83
+ height: 5.9rem;
84
+ background: var(--color-63);
85
+ border-radius: 4px;
86
+ }
87
+
88
+ input {
89
+ margin: 0.8rem 0;
90
+ }
91
+
92
+ select {
93
+ margin-top: 3.4rem;
94
+ margin-bottom: 2.4rem;
95
+ }
96
+
97
+ p {
98
+ padding-right: 1.6rem;
99
+ overflow: scroll;
100
+ text-align: justify;
101
+ }
102
+
103
+ svg {
104
+ cursor: pointer;
105
+ }
106
+
107
+ label,
108
+ input,
109
+ select,
110
+ button[type='submit'] {
111
+ @include min(tablet) {
112
+ width: calc(50% - 1.2rem);
113
+ }
114
+ }
115
+
116
+ @include min(tablet) {
117
+ label:nth-child(2) {
118
+ order: 1;
119
+ }
120
+ label:nth-child(4) {
121
+ order: 2;
122
+ }
123
+ label:nth-child(6) {
124
+ width: 100%;
125
+ order: 5;
126
+ }
127
+ label:nth-child(9) {
128
+ width: 100%;
129
+ order: 8;
130
+ }
131
+ input:nth-child(3) {
132
+ order: 3;
133
+ }
134
+ input:nth-child(5) {
135
+ order: 4;
136
+ }
137
+ input:nth-child(7) {
138
+ order: 6;
139
+ }
140
+ input:nth-child(10) {
141
+ margin-bottom: 0;
142
+ order: 9;
143
+ }
144
+ select {
145
+ margin: 0.8rem 0;
146
+ order: 7;
147
+ }
148
+ form.container button[type='submit'] {
149
+ margin-top: 0.8rem;
150
+ order: 10;
151
+ }
152
+ }
153
+
154
+ .resultContainer {
155
+ position: relative;
156
+ order: 11;
157
+ margin-top: 3.2rem;
158
+ width: 100%;
159
+ @include flex-align(center, space-between);
160
+ padding: 1.6rem;
161
+ color: #090e13;
162
+ font-weight: 700;
163
+ font-size: 24px;
164
+ line-height: 34px;
165
+ flex-direction: column;
166
+ gap: 1rem;
167
+
168
+ @include min(tablet) {
169
+ flex-direction: row;
170
+ gap: 0;
171
+ }
172
+
173
+ &:before {
174
+ content: '';
175
+ border-radius: 12px;
176
+ display: block;
177
+ background-color: var(--primary-color);
178
+ opacity: 0.6;
179
+ position: absolute;
180
+ top: 0;
181
+ right: 0;
182
+ bottom: 0;
183
+ left: 0;
184
+ }
185
+
186
+ > span {
187
+ z-index: 2;
188
+ }
189
+
190
+ > span:last-child {
191
+ flex-basis: 50%;
192
+ background: #ffffff;
193
+ border-radius: 8px;
194
+ font-weight: 700;
195
+ font-size: 28px;
196
+ line-height: 38px;
197
+ padding: .8rem;
198
+ @include flex-align(center, center);
199
+ }
200
+ }
@@ -0,0 +1,56 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ import React from 'react';
3
+ import { Context } from 'gatsby-core-theme/src/context/MainProvider';
4
+ import { AiOutlineQuestionCircle } from '@react-icons/all-files/ai/AiOutlineQuestionCircle';
5
+ import WageringCalculator from '.';
6
+
7
+ export default {
8
+ title: 'Matrix-Theme/Modules/Template Blocks/Wagering Calculator',
9
+ component: WageringCalculator,
10
+ argTypes: {
11
+ mainTitle: {
12
+ name: 'mainTitle',
13
+ type: { name: 'string', required: false },
14
+ description: 'Main Block Title',
15
+ defaultValue: 'Wagering Requirement Calculator',
16
+ },
17
+ infoIcon: {
18
+ name: 'infoIcon',
19
+ type: { name: 'object', required: false },
20
+ description: 'Info Block Icon',
21
+ defaultValue: AiOutlineQuestionCircle,
22
+ },
23
+ infoTitle: {
24
+ name: 'infoTitle',
25
+ type: { name: 'string', required: false },
26
+ description: 'Info Block Title',
27
+ defaultValue: 'Example: 20x wagering requirement',
28
+ },
29
+ infoText: {
30
+ name: 'infoText',
31
+ type: { name: 'string', required: false },
32
+ description: 'Info Block Text',
33
+ defaultValue:
34
+ 'Lorem ipsum dolor sit amet consectetur. Pharetra sed etiam placerat interdum ut. Pretium ipsum ultrices interdum condimentum nullam. Suscipit augue placerat laoreet hendrerit dui euismod quam rutrum. Magna in luctus egestas massa erat. Lorem ipsum dolor sit amet consectetur. Pharetra sed etiam placerat interdum ut. Pretium ipsum ultrices interdum condimentum nullam. Suscipit augue placerat laoreet hendrerit dui euismod quam rutrum. Magna in luctus egestas massa erat. Lorem ipsum dolor sit amet consectetur. Pharetra sed etiam placerat interdum ut. Pretium ipsum ultrices interdum condimentum nullam. Suscipit augue placerat laoreet hendrerit dui euismod quam rutrum. Magna in luctus egestas massa erat. Lorem ipsum dolor sit amet consectetur. Pharetra sed etiam placerat interdum ut. Pretium ipsum ultrices interdum condimentum nullam. Suscipit augue placerat laoreet hendrerit dui euismod quam rutrum. Magna in luctus egestas massa erat.',
35
+ },
36
+ },
37
+ };
38
+
39
+ const Template = (args) => (
40
+ <Context.Provider value={{}}>
41
+ <WageringCalculator {...args} />
42
+ </Context.Provider>
43
+ );
44
+
45
+ export const Default = Template.bind({});
46
+ Default.args = {
47
+ translations: {
48
+ wagecalc_deposit_amount: 'Deposit amount',
49
+ wagecalc_bonus_amount: 'Bonus amount',
50
+ wagecalc_wagering: 'Wagering',
51
+ wagecalc_bonus: 'Bonus',
52
+ wagecalc_deposit_bonus: 'Deposit + Bonus',
53
+ wagecalc_contribution: 'Contribution %',
54
+ wagecalc_calculate: 'Calculate',
55
+ },
56
+ };
@@ -0,0 +1,54 @@
1
+ /* eslint-disable no-multi-assign */
2
+ import React from 'react';
3
+ import { render, cleanup, fireEvent, waitFor } from '@testing-library/react';
4
+ import '@testing-library/jest-dom/extend-expect';
5
+ import { MdInfo } from '@react-icons/all-files/md/MdInfo';
6
+ import MainProvider from '~context/MainProvider';
7
+ import WageringCalculator from '.';
8
+
9
+ const props = {
10
+ mainTitle: 'Test Main Title',
11
+ infoTitle: 'Test Info Title',
12
+ infoText: 'Test Info Text',
13
+ infoIcon: MdInfo,
14
+ };
15
+
16
+ describe('Wagering Calculator', () => {
17
+ test('Template Block', async () => {
18
+ const { container, getByText, queryByText } = render(
19
+ <MainProvider value={{}}>
20
+ <WageringCalculator {...props} />
21
+ </MainProvider>
22
+ );
23
+
24
+ expect(getByText('Test Main Title')).toBeTruthy();
25
+
26
+ const infoIcon = container.querySelector('svg');
27
+ fireEvent.click(infoIcon);
28
+ expect(getByText('Test Info Title')).toBeTruthy();
29
+ expect(getByText('Test Info Text')).toBeTruthy();
30
+
31
+ const icons = container.querySelectorAll('svg');
32
+ fireEvent.click(icons[1]);
33
+ expect(queryByText('Test Info Title')).not.toBeInTheDocument();
34
+ expect(queryByText('Test Info Text')).not.toBeInTheDocument();
35
+
36
+ const inputs = container.querySelectorAll('input');
37
+ inputs.forEach((input, i) => {
38
+ input.value = i + 1;
39
+ });
40
+ expect(container.querySelector('.resultContainer')).toBeFalsy();
41
+ const calculate = container.querySelector('button');
42
+ fireEvent.click(calculate);
43
+ const select = container.querySelector('select');
44
+ select.selectedIndex = 1;
45
+ fireEvent.click(calculate);
46
+ await waitFor(() => {
47
+ expect(container.querySelector('.resultContainer')).toBeTruthy();
48
+ });
49
+ });
50
+ });
51
+
52
+ afterEach(() => {
53
+ cleanup();
54
+ });
@@ -94,6 +94,8 @@ const Modules = ({ module, page, pageContext, index, exclOperator }) => {
94
94
  return loadable(() => import('../../../../components/molecules/game-score-gauge'));
95
95
  case 'newsletter_optin':
96
96
  return loadable(() => import('../../../../components/molecules/newsletter-optin'));
97
+ case 'wagering_calculator':
98
+ return loadable(() => import('../../../../components/molecules/wagering-calculator'));
97
99
  default:
98
100
  return null;
99
101
  }
@@ -61,6 +61,7 @@
61
61
  --color-60: var(--color-58);
62
62
  --color-61: #5545A9;
63
63
  --color-62: #131313;
64
+ --color-63: #f8f7f5;
64
65
 
65
66
  //feedback-module
66
67
  --color-70: #9747ff;