gatsby-core-theme 25.0.4 → 25.0.6

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 CHANGED
@@ -1,3 +1,23 @@
1
+ ## [25.0.6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v25.0.5...v25.0.6) (2023-07-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add translation ([5187ffe](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5187ffe4a5957bac83ccae0b07e5d8f98b50dbd8))
7
+ * add translation key ([ca082ac](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ca082acd76077938a5b3592965ad180468061cef))
8
+ * bonuse module ([fd59a48](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fd59a48dc6f3e3191fe7d0b988d8d7c8303539d9))
9
+ * tests and storybook ([b3bc50d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b3bc50dd7dc902908942a042ff8c7c9e8e53d808))
10
+
11
+
12
+ * Merge branch 'tm-3396-bonuss' into 'master' ([8a53734](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8a53734f5e5ac53cf3149932b02b26bf3b6c9bb3))
13
+
14
+ ## [25.0.5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v25.0.4...v25.0.5) (2023-07-19)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * hreflangs ([1720573](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/17205731de2f406d56d66b80b6140d0c1c499eaf))
20
+
1
21
  ## [25.0.4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v25.0.3...v25.0.4) (2023-07-17)
2
22
 
3
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "25.0.4",
3
+ "version": "25.0.6",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -0,0 +1,212 @@
1
+ .container {
2
+ @include flex-direction(column);
3
+ @include flex-align(center, center);
4
+ border-radius: 16px;
5
+ background: var(--operator-banner-backgorund, #f4f4f4);
6
+ border-radius: 1.6rem;
7
+ padding: 1.6rem;
8
+ gap: 1.6rem;
9
+
10
+ > div {
11
+ width: 100%;
12
+ @include flex-direction(column);
13
+ gap: 1.6rem;
14
+
15
+ img {
16
+ min-width: 7.2rem;
17
+ width: 7.2rem;
18
+ height: 7.2rem;
19
+ border-radius: 0.8rem;
20
+ }
21
+ }
22
+
23
+ > a {
24
+ width: 100%;
25
+ border-radius: 10rem;
26
+ font-size: 1.4rem;
27
+ font-style: normal;
28
+ font-weight: 700;
29
+ line-height: 2.2rem;
30
+ > svg {
31
+ width: 1.4rem;
32
+ }
33
+ }
34
+ }
35
+ .logo {
36
+ cursor: pointer;
37
+ height: 7.2rem;
38
+ @include flex-direction(row);
39
+ gap: 16px;
40
+ }
41
+
42
+ .details {
43
+ @include flex-direction(column);
44
+ @include flex-align(flex-start, center);
45
+ > span:first-of-type {
46
+ color: #1b1b1c;
47
+ font-size: 1.6rem;
48
+ font-style: normal;
49
+ font-weight: 700;
50
+ line-height: 2.7rem;
51
+ margin-bottom: 0.8rem;
52
+ }
53
+ > div {
54
+ border-radius: 100px;
55
+ background: #fff;
56
+ border: 0px;
57
+ margin: 0;
58
+ height: 2.9rem;
59
+ width: 7.6rem;
60
+ @include flex-direction(row);
61
+ @include flex-align(center, center);
62
+ > span:first-of-type {
63
+ margin-right: 0.4rem;
64
+ }
65
+ > span:last-of-type {
66
+ font-size: 11px;
67
+ margin-top: 0.2rem;
68
+ }
69
+ }
70
+ }
71
+
72
+ .bonus {
73
+ border-radius: 0.8rem;
74
+ height: 100%;
75
+ background: var(--operator-banner-backgorund-bonus, #fff);
76
+ min-height: 6.4rem;
77
+ width: 100%;
78
+ @include flex-direction(column);
79
+ @include flex-align(center, center);
80
+ border: 1px solid #fff;
81
+ > div {
82
+ background-color: #f4f4f4;
83
+ width: 100%;
84
+ box-sizing: border-box;
85
+ margin: 0 auto;
86
+ border-bottom-left-radius: 8px;
87
+ border-bottom-right-radius: 8px;
88
+ color: #3c3c40;
89
+ text-align: center;
90
+ font-size: 1rem;
91
+ font-style: normal;
92
+ font-weight: 400;
93
+ line-height: 1.4rem;
94
+ padding: 0.8rem 2rem;
95
+ }
96
+ span:first-of-type {
97
+ color: var(--operator-banner-first-bonus, #1b1b1c);
98
+ text-align: center;
99
+ font-size: 1.6rem;
100
+ font-style: normal;
101
+ font-weight: 700;
102
+ line-height: 2.7rem;
103
+ margin-top: 0.8rem;
104
+ padding-right: 0;
105
+ }
106
+
107
+ span:last-of-type {
108
+ color: var(--operator-banner-second-bonus, #515156);
109
+ text-align: center;
110
+ font-size: 1.4rem;
111
+ font-style: normal;
112
+ font-weight: 700;
113
+ line-height: 2.2rem;
114
+ padding: 0;
115
+ margin-bottom: 0.7rem;
116
+ }
117
+ }
118
+
119
+ @include min(tablet) {
120
+ .container {
121
+ padding: 1.6rem 2.4rem;
122
+ @include flex-direction(row);
123
+ @include flex-align(center, center);
124
+
125
+ > a {
126
+ min-height: 5.6rem;
127
+ max-width: 19.7rem;
128
+ font-size: 1.8rem;
129
+ font-weight: 700;
130
+ line-height: 2.6rem;
131
+ }
132
+
133
+ > div {
134
+ @include flex-direction(row);
135
+ @include flex-align(center, flex-start);
136
+ img {
137
+ min-width: 9.6rem;
138
+ height: 9.6rem;
139
+ }
140
+ }
141
+ }
142
+
143
+ .logo {
144
+ @include flex-direction(row);
145
+ @include flex-align(center, center);
146
+ gap: 1.6rem;
147
+ height: auto;
148
+ }
149
+
150
+ .details {
151
+ display: flex;
152
+ flex-direction: column;
153
+
154
+ > span:first-of-type {
155
+ color: var(--operator-banner-name-color, #1b1b1c);
156
+ font-size: 1.4rem;
157
+ font-style: normal;
158
+ font-weight: 700;
159
+ line-height: 2.2rem;
160
+ margin-bottom: 0.8rem;
161
+ min-width: 11rem;
162
+ }
163
+ }
164
+ }
165
+
166
+ .showTncFixed {
167
+ > div {
168
+ > div:last-child {
169
+ height: 42px;
170
+ overflow-y: scroll;
171
+ color: #515156;
172
+ font-size: 10px;
173
+ font-style: normal;
174
+ font-weight: 400;
175
+ line-height: 14px;
176
+
177
+ &::-webkit-scrollbar {
178
+ width: 4px;
179
+ border-radius: 2px;
180
+ }
181
+ &::-webkit-scrollbar-track {
182
+ background: #cacaca;
183
+ border-radius: 2px;
184
+ }
185
+
186
+ &::-webkit-scrollbar-thumb {
187
+ background: #515156;
188
+ border-radius: 2px;
189
+ }
190
+ }
191
+ }
192
+ @include min(tablet) {
193
+ >div {
194
+ display: grid;
195
+ grid-template-columns: 1fr 20rem;
196
+ grid-template-rows: auto auto;
197
+ > div:last-of-type {
198
+ grid-column: 1/3;
199
+ grid-row: 2/3;
200
+ display: block;
201
+ }
202
+ > a {
203
+ grid-row: 1/2;
204
+ grid-column: 2/3;
205
+ }
206
+ > div:first-of-type {
207
+ grid-row: 1/2;
208
+ grid-column: 1/2;
209
+ }
210
+ }
211
+ }
212
+ }
@@ -7,12 +7,12 @@ import {
7
7
  ArgsTable,
8
8
  } from '@storybook/addon-docs/blocks';
9
9
 
10
- import OperatorBanner from '.';
10
+ import Bonus from '.';
11
11
  import getPageData from '~tests/factories/pages/default.factory';
12
12
 
13
13
  export default {
14
- title: 'Theme/Molecules/Operator Banner',
15
- component: OperatorBanner,
14
+ title: 'Theme/Modules/Bonus/Template One',
15
+ component: Bonus,
16
16
  argTypes: {
17
17
  operator: {
18
18
  name: 'operator',
@@ -24,46 +24,22 @@ export default {
24
24
  defaultValue: { summary: '' },
25
25
  },
26
26
  },
27
- hasLink: {
28
- name: 'hasLink',
27
+ tncEnable: {
28
+ name: 'TNC',
29
29
  type: { name: 'boolean', required: false },
30
30
  defaultValue: false,
31
- description:
32
- 'If the operator is placeholder (status=coming_soon) and hasLink=true it will show a link to the operator website.',
31
+ description: 'If tnc is enabel we show data for it, if is false we hide data',
33
32
  table: {
34
33
  type: { summary: 'boolean' },
35
34
  defaultValue: { summary: false },
36
35
  },
37
36
  },
38
- hasStars: {
39
- name: 'hasStars',
37
+ tncFixed: {
38
+ name: 'TNC Fixed',
40
39
  type: { name: 'boolean', required: false },
41
40
  defaultValue: false,
42
41
  description:
43
- 'If the logo is null and hasStars=true it will show a star-rating component on the banner.',
44
- table: {
45
- type: { summary: 'boolean' },
46
- defaultValue: { summary: false },
47
- },
48
- },
49
- logo: {
50
- name: 'logo',
51
- type: { name: 'string', required: false },
52
- defaultValue: '',
53
- description: 'The operator logo.',
54
- table: {
55
- type: { summary: 'string' },
56
- defaultValue: { summary: '' },
57
- },
58
- control: {
59
- type: null,
60
- },
61
- },
62
- sticky: {
63
- name: 'sticky',
64
- type: { name: 'boolean', required: false },
65
- defaultValue: false,
66
- description: 'If true it will be wrapped with a Sticky component.',
42
+ 'If tnxFix is an arg that help us to show the tnc data in the bottom of component and with scroll',
67
43
  table: {
68
44
  type: { summary: 'boolean' },
69
45
  defaultValue: { summary: false },
@@ -87,13 +63,11 @@ export default {
87
63
  },
88
64
  };
89
65
 
90
- const Template = (args) => <OperatorBanner {...args} />;
66
+ const Template = (args) => <Bonus {...args} />;
91
67
 
92
68
  export const Default = Template.bind({});
93
69
  Default.args = {
94
- hasLink: false,
95
- hasStars: false,
96
- logo: 'rizk-logopng7ed316ac19-original.png',
70
+ tncEnable: true,
71
+ tncFixed: false,
97
72
  operator: getPageData().relation,
98
- sticky: false,
99
73
  };
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import Bonus from '.';
4
+
5
+ describe('Bonus', () => {
6
+ const operator = {
7
+ standardised_logo_url: 'logo-url',
8
+ logo: 'standardised-logo',
9
+ logo_url: 'logo-url',
10
+ bonus: {
11
+ rating: '4.5',
12
+ },
13
+ name: 'Rizk',
14
+ url: 'operator-url',
15
+ extra_fields: {
16
+ terms_and_conditions_text_enabled: 'true',
17
+ },
18
+ status: 'active',
19
+ };
20
+
21
+ test('renders operator name', () => {
22
+ render(<Bonus operator={operator} />);
23
+ const operatorName = screen.getByText('Rizk');
24
+ expect(operatorName).toBeInTheDocument();
25
+ });
26
+
27
+ test('renders operator bonus rating', () => {
28
+ render(<Bonus operator={operator} />);
29
+ const bonusRating = screen.getByText(operator.bonus.rating);
30
+ expect(bonusRating).toBeInTheDocument();
31
+ });
32
+
33
+ test('renders operator CTA', () => {
34
+ render(<Bonus operator={operator} />);
35
+ const operatorCTA = screen.getByLabelText(`${operator.name} Link`);
36
+ expect(operatorCTA).toBeInTheDocument();
37
+ });
38
+
39
+ test('renders operator TNC', () => {
40
+ render(<Bonus operator={operator} tncEnable />);
41
+ const operatorTNC = screen.getByText('18+ New Players only. Play responsibly.');
42
+ expect(operatorTNC).toBeInTheDocument();
43
+ });
44
+
45
+ test('does not render operator TNC when tncEnable is false', () => {
46
+ render(<Bonus operator={operator} tncEnable={false} />);
47
+ const operatorTNC = screen.queryByText('18+ New Players only. Play responsibly.');
48
+ expect(operatorTNC).not.toBeInTheDocument();
49
+ });
50
+ });
@@ -0,0 +1,98 @@
1
+ /* eslint-disable camelcase */
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { FaArrowRight } from '@react-icons/all-files/fa/FaArrowRight';
5
+ import { prettyTracker, imagePrettyUrl } from '~helpers/getters';
6
+ import LazyImage from '~hooks/lazy-image';
7
+ import Onliner from '~atoms/bonus';
8
+ import OperatorCta from '~atoms/operator-cta-button';
9
+ import Rating from '~molecules/star-rating/one-star';
10
+ import Tnc from '~molecules/tnc';
11
+ import styles from './bonus.module.scss';
12
+
13
+ export default function Bonus({
14
+ operator,
15
+ pageTemplate,
16
+ module,
17
+ tncEnable = true,
18
+ tncFixed = false,
19
+ }) {
20
+ const prettyLink = prettyTracker(
21
+ operator,
22
+ module?.tracking_link_name || 'main',
23
+ false,
24
+ pageTemplate
25
+ );
26
+ const { standardised_logo_url, logo_url, bonus, name } = operator;
27
+ const logo = standardised_logo_url || logo_url;
28
+
29
+ const showTncFixed = tncEnable && tncFixed;
30
+
31
+ return (
32
+ <div
33
+ className={`${styles.operatorBanner || ''} ${showTncFixed ? styles.showTncFixed || '' : ''}`}
34
+ >
35
+ <div className={styles.container}>
36
+ <div>
37
+ <a
38
+ href={prettyLink}
39
+ className={`${styles.logo || ''} operator-banner-gtm logo-cta`}
40
+ title={operator?.name}
41
+ target="_blank"
42
+ rel="noreferrer"
43
+ aria-label={`${operator?.name} Link`}
44
+ >
45
+ <LazyImage
46
+ alt={operator?.name}
47
+ src={imagePrettyUrl(logo)}
48
+ loading="eager"
49
+ height={120}
50
+ width={100}
51
+ />
52
+ <div className={styles.details}>
53
+ {name && <span>{name}</span>}
54
+ {bonus?.rating && <Rating rating={bonus?.rating} showDecimal />}
55
+ </div>
56
+ </a>
57
+ <div className={styles.bonus || ''}>
58
+ <Onliner item={operator} tracker={module?.type || 'main'} />
59
+ {tncEnable && !tncFixed && <Tnc hasCollapse={false} operator={operator} />}
60
+ </div>
61
+ </div>
62
+
63
+ <OperatorCta
64
+ operator={operator}
65
+ pageTemplate={pageTemplate}
66
+ tracker={module?.tracking_link_name || 'main'}
67
+ icon={<FaArrowRight fontSize={20} />}
68
+ />
69
+ {showTncFixed && <Tnc hasCollapse={false} operator={operator} />}
70
+ </div>
71
+ </div>
72
+ );
73
+ }
74
+
75
+ Bonus.propTypes = {
76
+ operator: PropTypes.shape({
77
+ standardised_logo_url: PropTypes.string,
78
+ logo: PropTypes.string,
79
+ logo_url: PropTypes.string,
80
+ bonus: PropTypes.shape({
81
+ rating: PropTypes.string,
82
+ }),
83
+ name: PropTypes.string,
84
+ rating: PropTypes.string,
85
+ url: PropTypes.string,
86
+ extra_fields: PropTypes.shape({
87
+ terms_and_conditions_text_enabled: PropTypes.string,
88
+ }),
89
+ status: PropTypes.string,
90
+ }),
91
+ tncFixed: PropTypes.bool,
92
+ tncEnable: PropTypes.bool,
93
+ pageTemplate: PropTypes.string,
94
+ module: PropTypes.shape({
95
+ tracking_link_name: PropTypes.string,
96
+ type: PropTypes.string,
97
+ }),
98
+ };