gatsby-matrix-theme 7.1.64 → 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 (53) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/package.json +1 -1
  3. package/src/components/atoms/select/index.js +43 -0
  4. package/src/components/atoms/select/select.module.scss +31 -0
  5. package/src/components/atoms/select/select.test.js +53 -0
  6. package/src/components/molecules/horse-calculator/horse-calculator.module.scss +204 -0
  7. package/src/components/molecules/horse-calculator/horse-calculator.stories.js +36 -0
  8. package/src/components/molecules/horse-calculator/index.js +566 -0
  9. package/src/constants/horse-racing-calculator.js +283 -0
  10. package/src/gatsby-core-theme/components/molecules/module/index.js +2 -0
  11. package/src/gatsby-core-theme/components/pages/body/index.js +21 -19
  12. package/src/gatsby-core-theme/styles/utils/variables/_main.scss +11 -1
  13. package/src/helpers/horse-racing-calculator/bookmaker-bonus.js +82 -0
  14. package/src/helpers/horse-racing-calculator/index.js +471 -0
  15. package/storybook/public/0.799c368cbe88266827ba.manager.bundle.js +1 -0
  16. package/storybook/public/1.9ebd2fb519f6726108de.manager.bundle.js +1 -0
  17. package/storybook/public/10.a85ea1a67689be8e19ff.manager.bundle.js +1 -0
  18. package/storybook/public/11.f4e922583ae35da460f3.manager.bundle.js +2 -0
  19. package/storybook/public/11.f4e922583ae35da460f3.manager.bundle.js.LICENSE.txt +12 -0
  20. package/storybook/public/12.1415460941f0bdcb8fa8.manager.bundle.js +1 -0
  21. package/storybook/public/252.77113a89.iframe.bundle.js +7 -0
  22. package/storybook/public/252.77113a89.iframe.bundle.js.LICENSE.txt +84 -0
  23. package/storybook/public/252.77113a89.iframe.bundle.js.map +1 -0
  24. package/storybook/public/29.81c8da24.iframe.bundle.js +1 -0
  25. package/storybook/public/332.678703ab.iframe.bundle.js +1 -0
  26. package/storybook/public/409.b4c1872e.iframe.bundle.js +1 -0
  27. package/storybook/public/5.f459d151315e6780c20f.manager.bundle.js +2 -0
  28. package/storybook/public/5.f459d151315e6780c20f.manager.bundle.js.LICENSE.txt +8 -0
  29. package/storybook/public/500.a1e5c8d8.iframe.bundle.js +1 -0
  30. package/storybook/public/567.18a981a5.iframe.bundle.js +1 -0
  31. package/storybook/public/6.3bd64d820f3745f262ff.manager.bundle.js +1 -0
  32. package/storybook/public/7.3d04765dbf3f1dcd706c.manager.bundle.js +1 -0
  33. package/storybook/public/720.6ee5a175.iframe.bundle.js +1 -0
  34. package/storybook/public/738.be449817.iframe.bundle.js +2 -0
  35. package/storybook/public/738.be449817.iframe.bundle.js.LICENSE.txt +12 -0
  36. package/storybook/public/766.47f12b05.iframe.bundle.js +1 -0
  37. package/storybook/public/8.b541eadfcb9164835dfc.manager.bundle.js +1 -0
  38. package/storybook/public/805.7894ddea.iframe.bundle.js +2 -0
  39. package/storybook/public/805.7894ddea.iframe.bundle.js.LICENSE.txt +8 -0
  40. package/storybook/public/9.411ac8e451bbb10926c7.manager.bundle.js +1 -0
  41. package/storybook/public/94.4342cbcf.iframe.bundle.js +1 -0
  42. package/storybook/public/974.e2f03aac.iframe.bundle.js +1 -0
  43. package/storybook/public/favicon.ico +0 -0
  44. package/storybook/public/iframe.html +348 -0
  45. package/storybook/public/index.html +51 -0
  46. package/storybook/public/main.58ee6c5c0cfaec21e272.manager.bundle.js +1 -0
  47. package/storybook/public/main.b62a06e0.iframe.bundle.js +1 -0
  48. package/storybook/public/runtime~main.91a0c7330ab317d35c4a.manager.bundle.js +1 -0
  49. package/storybook/public/runtime~main.e5cc1419.iframe.bundle.js +1 -0
  50. package/storybook/public/static/media/popup-bg.51d14d2d.webp +0 -0
  51. package/storybook/public/static/media/summaryBackground.92dfe7de.jpeg +0 -0
  52. package/storybook/public/vendors~main.f7f16cebbf3aa96a4f89.manager.bundle.js +2 -0
  53. package/storybook/public/vendors~main.f7f16cebbf3aa96a4f89.manager.bundle.js.LICENSE.txt +110 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
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
+
1
18
  ## [7.1.64](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v7.1.63...v7.1.64) (2022-10-07)
2
19
 
3
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-matrix-theme",
3
- "version": "7.1.64",
3
+ "version": "7.2.0",
4
4
  "main": "index.js",
5
5
  "description": "Matrix Theme NPM Package",
6
6
  "author": "",
@@ -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({});