gatsby-matrix-theme 7.1.63 → 7.2.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 (28) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/package.json +2 -2
  3. package/src/components/atoms/newsletter/form/index.js +12 -3
  4. package/src/components/atoms/select/index.js +43 -0
  5. package/src/components/atoms/select/select.module.scss +31 -0
  6. package/src/components/atoms/select/select.test.js +53 -0
  7. package/src/components/molecules/horse-calculator/horse-calculator.module.scss +204 -0
  8. package/src/components/molecules/horse-calculator/horse-calculator.stories.js +36 -0
  9. package/src/components/molecules/horse-calculator/index.js +566 -0
  10. package/src/components/molecules/newsletter/index.js +18 -7
  11. package/src/components/molecules/newsletter/newsletter.module.scss +20 -1
  12. package/src/components/organisms/footer-navigation/index.js +1 -8
  13. package/src/constants/horse-racing-calculator.js +283 -0
  14. package/src/constants/settings/newsletter.js +11 -0
  15. package/src/gatsby-core-theme/components/molecules/main/index.js +14 -6
  16. package/src/gatsby-core-theme/components/molecules/module/index.js +2 -0
  17. package/src/gatsby-core-theme/components/organisms/toplist/index.js +1 -0
  18. package/src/gatsby-core-theme/components/organisms/toplist/list/index.js +6 -1
  19. package/src/gatsby-core-theme/components/pages/body/index.js +21 -19
  20. package/src/gatsby-core-theme/hooks/modal/modal-content.js +26 -19
  21. package/src/gatsby-core-theme/styles/utils/variables/_main.scss +11 -1
  22. package/src/helpers/horse-racing-calculator/bookmaker-bonus.js +82 -0
  23. package/src/helpers/horse-racing-calculator/index.js +471 -0
  24. package/storybook/public/iframe.html +1 -1
  25. package/storybook/public/main.b62a06e0.iframe.bundle.js +1 -0
  26. package/src/gatsby-core-theme/helpers/schema.js +0 -137
  27. package/src/gatsby-core-theme/helpers/schema.test.js +0 -165
  28. package/storybook/public/main.fa2772aa.iframe.bundle.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,48 @@
1
+ # [7.2.0](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v7.1.64...v7.2.0) (2022-10-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * added test for select component ([5ad7757](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/5ad7757ffda2c7c8bce84841df6fb79be979a463))
7
+ * build error ([a55d86a](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/a55d86a8fa38261329d4f1d7a6354f8adb062b16))
8
+ * popup and cookie ([7bfd947](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/7bfd9478712babfff4c877aeb4580db5d6255f64))
9
+
10
+
11
+ * Merge branch 'tm-2958-horse-racing-calculator' into 'master' ([807e5e2](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/807e5e2d7447019a046ec7a2ab9fec5bc6ecf5af))
12
+
13
+
14
+ ### Features
15
+
16
+ * new horse racing calculator template block ([430f17e](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/430f17e2f2bab82a6644715414525ef9a17c1e2c))
17
+
18
+ ## [7.1.64](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v7.1.63...v7.1.64) (2022-10-07)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * added newsletter layer ([e970a68](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e970a68b11a05ae9ee2617edc102198147e923d3))
24
+ * added theme style from input style module ([bc9830d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/bc9830d552aa427ac21e1bd7ce641eb100aac859))
25
+ * deleted the unnecessary function ([79b4b0d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/79b4b0dddd3e0ea733e7ed9dbecfeb96f2de7fa4))
26
+ * newsletter layout prop ([d602d4b](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/d602d4bff8c98cb9acf3d766f46d6793c6cb4bfe))
27
+ * open modal for toplist nsa ([3352aa5](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/3352aa5c8f1c8ff76bed4c1be94aec4065fb3024))
28
+ * remove schema matrix ([3013ef2](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/3013ef279224eee63f8da43a1b4a89fac0c183b5))
29
+ * removed timeout on footer navigation ([dedcbab](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/dedcbab9caf8f9ec6dd9d601967909fe5d04758b))
30
+ * updated to latest core version ([709f417](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/709f4175e2522e5d6ae157b511a35a3c2a3a480e))
31
+
32
+
33
+ ### Code Refactoring
34
+
35
+ * update newsletter box positioning ([99b1bc5](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/99b1bc5f48445cac234bf556fd8c030433bcfee2))
36
+ * update newsletter form for prop ([eb47237](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/eb47237fce1b6ec75983c6b5ebe54e7f9e48a05a))
37
+ * update newsletter override and main component ([54d2786](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/54d27860a63149ae8608af35ad299043b96ba8b2))
38
+
39
+
40
+ * Merge branch 'tm-2999-update-newsletter-box' into 'master' ([f4a5ca1](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/f4a5ca1d0e972a7da2c5c1adad9c1020051a26de))
41
+ * Merge branch 'tm-2833-schema-bible-matrix-remove' into 'master' ([de40677](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/de40677097a43e27d530559705c3461f78bc8a21))
42
+ * Merge branch 'tm-3014-sign-up-layer' into 'master' ([ca39c10](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/ca39c101fb8fabd1860d204855addf2f199245b5))
43
+ * Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/matrix-theme ([f9628d0](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/f9628d0c3e64b48afd1d934341d6502ceb24614f))
44
+ * Merge branch 'tm-3003-toplist-style-theme' into 'master' ([c1f13c8](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/c1f13c8191b1375be674ff28960e0ec2e4353ee8))
45
+
1
46
  ## [7.1.63](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v7.1.62...v7.1.63) (2022-09-29)
2
47
 
3
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-matrix-theme",
3
- "version": "7.1.63",
3
+ "version": "7.2.0",
4
4
  "main": "index.js",
5
5
  "description": "Matrix Theme NPM Package",
6
6
  "author": "",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "gatsby": "^4.20.0",
27
- "gatsby-core-theme": "12.0.1",
27
+ "gatsby-core-theme": "12.0.2",
28
28
  "gatsby-plugin-sharp": "^4.10.2",
29
29
  "gatsby-plugin-sitemap": "^3.3.0",
30
30
  "gatsby-transformer-sharp": "^4.10.0",
@@ -171,7 +171,9 @@ const NewsletterForm = ({
171
171
 
172
172
  <form ref={form} onSubmit={handelSubmit}>
173
173
  {formTextTranslated.textAboveName ? (
174
- <p className={styles.textAboveInput}>{formTextTranslated.textAboveName}</p>
174
+ <label className={styles.textAboveInput} htmlFor="name">
175
+ {formTextTranslated.textAboveName}
176
+ </label>
175
177
  ) : null}
176
178
 
177
179
  <input
@@ -179,9 +181,12 @@ const NewsletterForm = ({
179
181
  placeholder={formTextTranslated.placeholderName}
180
182
  type="text"
181
183
  name="name"
184
+ id="name"
182
185
  />
183
186
  {formTextTranslated.textAboveEmail ? (
184
- <p className={styles.textAboveInput}>{formTextTranslated.textAboveEmail}</p>
187
+ <label className={styles.textAboveInput} htmlFor="email">
188
+ {formTextTranslated.textAboveEmail}
189
+ </label>
185
190
  ) : null}
186
191
 
187
192
  <input
@@ -189,9 +194,12 @@ const NewsletterForm = ({
189
194
  placeholder={formTextTranslated.placeholderEmail}
190
195
  type="email"
191
196
  name="email"
197
+ id="email"
192
198
  />
193
199
  {formTextTranslated.textAbovePhoneNumber ? (
194
- <p className={styles.textAboveInput}>{formTextTranslated.textAbovePhoneNumber}</p>
200
+ <label className={styles.textAboveInput} htmlFor="phone">
201
+ {formTextTranslated.textAbovePhoneNumber}
202
+ </label>
195
203
  ) : null}
196
204
 
197
205
  {formTextTranslated.placeholderPhoneNumber && (
@@ -200,6 +208,7 @@ const NewsletterForm = ({
200
208
  placeholder={formTextTranslated.placeholderPhoneNumber}
201
209
  type="tel"
202
210
  name="phone"
211
+ id="phone"
203
212
  />
204
213
  )}
205
214
  <PrivacyandSuccess
@@ -0,0 +1,43 @@
1
+ /* eslint-disable react/forbid-prop-types */
2
+ import React, { useContext } from 'react';
3
+ // eslint-disable-next-line import/no-extraneous-dependencies
4
+ import PropTypes from 'prop-types';
5
+ import { Context } from 'gatsby-core-theme/src/context/TranslationsProvider';
6
+
7
+ import { translate } from 'gatsby-core-theme/src/helpers/getters';
8
+
9
+ import styles from './select.module.scss';
10
+
11
+ export default function Select({ label = null, id, onChangeFunc = () => {}, options, ref, index }) {
12
+ const { translations } = useContext(Context) || {};
13
+
14
+ if (!label) {
15
+ return (
16
+ <div className={styles.dropdownStyling}>
17
+ <select ref={ref} onChange={(e) => onChangeFunc(e, index)} id={id}>
18
+ {options.map((option) => option)}
19
+ </select>
20
+ </div>
21
+ );
22
+ }
23
+
24
+ return (
25
+ <label htmlFor={id}>
26
+ {translate(translations, id, label)}
27
+ <div className={styles.dropdownStyling}>
28
+ <select ref={ref} onChange={(e) => onChangeFunc(e, index)} id={id}>
29
+ {options.map((option) => option)}
30
+ </select>
31
+ </div>
32
+ </label>
33
+ );
34
+ }
35
+
36
+ Select.propTypes = {
37
+ label: PropTypes.string,
38
+ id: PropTypes.string,
39
+ onChangeFunc: PropTypes.func,
40
+ options: PropTypes.arrayOf(PropTypes.any),
41
+ ref: PropTypes.func,
42
+ index: PropTypes.number,
43
+ };
@@ -0,0 +1,31 @@
1
+ .dropdownStyling {
2
+ position: relative;
3
+ select {
4
+ -webkit-appearance: none;
5
+ -moz-appearance: none;
6
+ appearance: none;
7
+ border: none;
8
+ color: #1a1c1f;
9
+ background: var(--horse-calc-input-background, #f3f2f2);
10
+ border-radius: var(--horse-calc-input-border-radius, .4rem);
11
+ font-weight: 400;
12
+ font-size: 16px;
13
+ padding: 1.6rem 1.5rem;
14
+ width: 100%;
15
+
16
+ @include min(tablet) {
17
+ padding: 1.6rem 2.4rem;
18
+ }
19
+ }
20
+
21
+ &:after {
22
+ @include arrow(var(--horse-calc-label-color, #1a1c1f), 0.8rem, down, false);
23
+ position: absolute;
24
+ right: 1.5rem;
25
+ top: 38%;
26
+
27
+ @include min(tablet) {
28
+ right: 2.4rem;
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import { render, cleanup, fireEvent } from '@testing-library/react';
3
+ import '@testing-library/jest-dom';
4
+ import Select from '.';
5
+
6
+ describe('Select Component', () => {
7
+ test('render with label and Id', () => {
8
+ const { container, getByText } = render(
9
+ <Select
10
+ label="test label"
11
+ id="test_id"
12
+ options={[
13
+ <option key={1} value="Yes">
14
+ Yes
15
+ </option>,
16
+ <option key={2} value="No">
17
+ No
18
+ </option>,
19
+ ]}
20
+ />
21
+ );
22
+ expect(container).toBeTruthy();
23
+ expect(container.querySelectorAll('select')).toHaveLength(1);
24
+ expect(getByText('test label')).toBeTruthy();
25
+ expect(container.querySelector('select').getAttribute('id')).toEqual('test_id');
26
+ });
27
+
28
+ test('render with change functions', () => {
29
+ const handleChange = jest.fn();
30
+
31
+ const { container } = render(
32
+ <Select
33
+ id="test_id"
34
+ onChangeFunc={handleChange}
35
+ options={[
36
+ <option key={1} value="Yes">
37
+ Yes
38
+ </option>,
39
+ <option key={2} value="No">
40
+ No
41
+ </option>,
42
+ ]}
43
+ />
44
+ );
45
+
46
+ expect(container).toBeTruthy();
47
+ fireEvent.change(container.querySelector('select'), { target: { value: 2 } });
48
+ expect(handleChange).toHaveBeenCalled();
49
+ });
50
+ });
51
+ afterEach(() => {
52
+ cleanup();
53
+ });
@@ -0,0 +1,204 @@
1
+ .innerContainer {
2
+ background: #ffffff;
3
+ box-shadow: var(--horse-calc-shadow, 0px -3px 14px rgba(0, 0, 0, 0.09));
4
+ border-radius: var(--horse-calc-border-radius, 1.6rem);
5
+ border: 1px solid var(--horse-calc-border-color, transparent);
6
+ padding: 3.7rem 1rem;
7
+ color: var(--horse-calc-label-color, #150e06);
8
+ margin-top: 2rem;
9
+
10
+ @include min(tablet) {
11
+ padding: 3.7rem 2.4rem;
12
+ }
13
+
14
+ h2 {
15
+ margin-top: 0;
16
+ }
17
+
18
+ input {
19
+ background-color: #f3f2f2;
20
+ padding: 1.6rem 2.4rem;
21
+ width: 100%;
22
+ border-radius: 4px;
23
+ }
24
+
25
+ > div {
26
+ @include flex-direction(column);
27
+ gap: 2rem;
28
+ > div {
29
+ gap: 1rem;
30
+
31
+ @include min(tablet) {
32
+ display: grid;
33
+ grid-template-columns: repeat(2, 1fr);
34
+ }
35
+
36
+ > label {
37
+ @include flex-direction(column);
38
+ flex-basis: 50%;
39
+ gap: 1rem;
40
+ font-weight: 700;
41
+ font-size: 16px;
42
+ line-height: 23px;
43
+
44
+ > div > select {
45
+ width: 100% !important;
46
+ }
47
+ }
48
+ }
49
+
50
+ table {
51
+ width: 100%;
52
+
53
+ th,
54
+ tr {
55
+ border: var(--horse-calc-outcome-table-header-border-width, 1.5px) solid var(--horse-calc-outcome-table-header-border-color, #dcd9d3);
56
+
57
+ &.deadHeatEnabled,
58
+ &.selectionNotesRow {
59
+ border-bottom: none;
60
+ }
61
+
62
+ &.deadHeatRow,
63
+ &.selectionNotesEnabled {
64
+ border-top: none;
65
+ }
66
+ }
67
+ th {
68
+ border-color: var(--table-head-background);
69
+ }
70
+
71
+ thead {
72
+ tr {
73
+ background: var(--table-head-background);
74
+ th {
75
+ padding: 1rem;
76
+ vertical-align: top;
77
+ padding-left: 1.4rem;
78
+ color: var(--horse-calc-label-color, #150e06);
79
+
80
+ font-weight: 700;
81
+
82
+ &:first-child {
83
+ width: 4rem;
84
+ }
85
+ }
86
+ }
87
+ }
88
+
89
+ tbody {
90
+ tr {
91
+ td {
92
+ text-align: center;
93
+ padding: 1rem;
94
+ }
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+
101
+ .fullWidth {
102
+ display: flex !important;
103
+
104
+ label {
105
+ flex-basis: 100% !important;
106
+ }
107
+ }
108
+
109
+ .deadHeat {
110
+ @include flex-align(center, space-between);
111
+ gap: 1rem;
112
+
113
+ label:nth-child(2) {
114
+ flex-grow: 1;
115
+ }
116
+ }
117
+
118
+ .outcomeTable {
119
+ background: #f3f2f2;
120
+ border-spacing: 0 !important;
121
+ display: flex;
122
+
123
+ @include min(tablet) {
124
+ display: table;
125
+ }
126
+
127
+ thead,
128
+ tbody {
129
+ width: 50%;
130
+ }
131
+
132
+ tr {
133
+ width: 100%;
134
+ display: block;
135
+
136
+ @include min(tablet) {
137
+ width: auto;
138
+ display: table-row;
139
+ }
140
+ }
141
+
142
+ td,
143
+ th {
144
+ width: 100% !important;
145
+ display: block;
146
+
147
+ @include min(tablet) {
148
+ display: table-cell;
149
+ width: auto !important;
150
+ }
151
+ }
152
+
153
+ th,
154
+ tr {
155
+ border: none !important;
156
+ }
157
+
158
+ thead {
159
+ tr {
160
+ th {
161
+ background: var(--horse-calc-totals-table-header-background, #17d670) !important;
162
+
163
+ &:first-child {
164
+ width: auto !important;
165
+ }
166
+ }
167
+ }
168
+ }
169
+ }
170
+
171
+ .foldTable {
172
+ border-collapse: collapse;
173
+
174
+ thead {
175
+ tr {
176
+ th {
177
+ &:first-child {
178
+ width: auto !important;
179
+ }
180
+ }
181
+ }
182
+ }
183
+ }
184
+
185
+ .ctaContainer {
186
+ margin-top: 2rem;
187
+ @include flex-align(center, center);
188
+ }
189
+
190
+ .currencyInput {
191
+ position: relative;
192
+
193
+ input {
194
+ padding-left: 4rem;
195
+ }
196
+
197
+ &:before {
198
+ content: attr(data-curr-symbol);
199
+ position: absolute;
200
+ left: 2rem;
201
+ top: 1.4rem;
202
+ font-weight: 500;
203
+ }
204
+ }
@@ -0,0 +1,36 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ import React from 'react';
3
+ import {
4
+ Title,
5
+ Description,
6
+ Primary,
7
+ PRIMARY_STORY,
8
+ ArgsTable,
9
+ } from '@storybook/addon-docs/blocks';
10
+
11
+ import HorseRacingCalculator from '.';
12
+
13
+ export default {
14
+ title: 'Matrix-Theme/Molecules/HorseRacingCalculator',
15
+ component: HorseRacingCalculator,
16
+ argTypes: {},
17
+ parameters: {
18
+ docs: {
19
+ description: {
20
+ component: 'Horse racing calculator component',
21
+ },
22
+ page: () => (
23
+ <>
24
+ <Title />
25
+ <Description />
26
+ <Primary />
27
+ <ArgsTable story={PRIMARY_STORY} />
28
+ </>
29
+ ),
30
+ },
31
+ },
32
+ };
33
+
34
+ const Template = (args) => <HorseRacingCalculator {...args} />;
35
+
36
+ export const Default = Template.bind({});