gatsby-core-theme 18.0.13 → 18.0.15
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 +24 -0
- package/package.json +1 -1
- package/src/components/atoms/operator-cta-button/index.js +88 -0
- package/src/components/atoms/{operator-cta-two/operator-cta-two.module.scss → operator-cta-button/operator-cta-button.module.scss} +27 -1
- package/src/components/atoms/{operator-cta-two/operator-cta-two.stories.js → operator-cta-button/operator-cta-button.stories.js} +10 -10
- package/src/components/atoms/operator-cta-button/operator-cta-button.test.js +50 -0
- package/src/components/molecules/operator-banner/index.js +1 -1
- package/src/components/molecules/operator-banner/operator-banner.module.scss +1 -1
- package/src/components/molecules/toplist/default-row/index.js +1 -1
- package/src/constants/settings.js +2 -0
- package/src/helpers/processor/index.js +3 -1
- package/src/components/atoms/operator-cta-two/index.js +0 -70
- package/src/components/atoms/operator-cta-two/operator-cta-two.test.js +0 -50
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
## [18.0.15](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v18.0.14...v18.0.15) (2023-02-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* added an incative type ([08bfa67](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/08bfa67e84a9d491ae1a425cf46d757fdb4d7830))
|
|
7
|
+
* cta status ([0e70f42](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0e70f424be3b779fbfb980d610d3649737d0a420))
|
|
8
|
+
* cta style ([dec87b7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/dec87b7be55f21f42c298f34b1b03cfeb588c061))
|
|
9
|
+
* cta style ([e4d8dc1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e4d8dc15652ea98555dad3ed7fe8ac7bfb25ad65))
|
|
10
|
+
* operator cta ([4b26527](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4b265276a0e7a9e2b6e362a650aca9aac38c1f44))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
* Merge branch 'tm-3297-operator-cta-core' into 'master' ([b53a207](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b53a207147c177cd68d306ee1df5133d8c6528b6))
|
|
14
|
+
|
|
15
|
+
## [18.0.14](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v18.0.13...v18.0.14) (2023-02-21)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* sports data for operator type pages ([4c45f22](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4c45f22345481b7f48c4e6b72fbc0c7f967de363))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
* Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([58ef78c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/58ef78c0a0d40f9711fc6db294bc62071f4d7925))
|
|
24
|
+
|
|
1
25
|
## [18.0.13](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v18.0.12...v18.0.13) (2023-02-16)
|
|
2
26
|
|
|
3
27
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Context } from '~context/MainProvider';
|
|
4
|
+
import { prettyTracker, translate } from '~helpers/getters';
|
|
5
|
+
|
|
6
|
+
import styles from './operator-cta-button.module.scss';
|
|
7
|
+
|
|
8
|
+
const OperatorCtaButton = ({
|
|
9
|
+
operator,
|
|
10
|
+
pageTemplate,
|
|
11
|
+
gtmClass = '',
|
|
12
|
+
buttonType = 'primary',
|
|
13
|
+
buttonSize = '',
|
|
14
|
+
tracker = 'main',
|
|
15
|
+
icon = null,
|
|
16
|
+
translationsObj = {
|
|
17
|
+
active: { translationKey: 'play_now', defaultValue: 'Visit' },
|
|
18
|
+
not_recommended: { translationKey: 'not_recommended', defaultValue: 'Not Recommended' },
|
|
19
|
+
coming_soon: { translationKey: 'coming_soon', defaultValue: 'Soon Available' },
|
|
20
|
+
inactive: { translationKey: 'inactive', defaultValue: 'Not Accepting New Players' },
|
|
21
|
+
blacklisted: { translationKey: 'blacklisted', defaultValue: 'Blacklisted' },
|
|
22
|
+
},
|
|
23
|
+
}) => {
|
|
24
|
+
const { translations } = useContext(Context) || {};
|
|
25
|
+
const status = operator?.status || '';
|
|
26
|
+
const trackerType = tracker?.toLowerCase()?.replace(' ', '_');
|
|
27
|
+
const prettyLink = prettyTracker(operator, trackerType, false, pageTemplate);
|
|
28
|
+
|
|
29
|
+
const translateBtn =
|
|
30
|
+
status && translationsObj[status]
|
|
31
|
+
? translate(
|
|
32
|
+
translations,
|
|
33
|
+
translationsObj[status]?.translationKey,
|
|
34
|
+
translationsObj[status]?.defaultValue || ''
|
|
35
|
+
)
|
|
36
|
+
: '';
|
|
37
|
+
|
|
38
|
+
const classes = `${styles[buttonType]} ${status && styles[status] ? styles[status] : ''} ${
|
|
39
|
+
buttonSize ? styles[`${buttonSize}_size`] : ''
|
|
40
|
+
} `;
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<a
|
|
44
|
+
{...(status === 'active' ? { href: prettyLink } : {})}
|
|
45
|
+
title={typeof translateBtn === 'string' ? translateBtn : ''}
|
|
46
|
+
aria-label={typeof translateBtn === 'string' ? translateBtn : ''}
|
|
47
|
+
className={`${classes} ${gtmClass}`}
|
|
48
|
+
{...(status === 'active' ? { target: '_blank' } : {})}
|
|
49
|
+
{...(status === 'active' ? { rel: 'nofollow noreferrer' } : {})}
|
|
50
|
+
>
|
|
51
|
+
{translateBtn}
|
|
52
|
+
{icon && icon}
|
|
53
|
+
</a>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
OperatorCtaButton.propTypes = {
|
|
58
|
+
operator: PropTypes.shape({
|
|
59
|
+
name: PropTypes.string,
|
|
60
|
+
status: PropTypes.string,
|
|
61
|
+
}),
|
|
62
|
+
gtmClass: PropTypes.string,
|
|
63
|
+
pageTemplate: PropTypes.string,
|
|
64
|
+
buttonSize: PropTypes.string,
|
|
65
|
+
buttonType: PropTypes.string,
|
|
66
|
+
tracker: PropTypes.string,
|
|
67
|
+
translationsObj: PropTypes.shape({
|
|
68
|
+
active: PropTypes.shape({
|
|
69
|
+
translationKey: PropTypes.string,
|
|
70
|
+
defaultValue: PropTypes.string,
|
|
71
|
+
}),
|
|
72
|
+
not_recommended: PropTypes.shape({
|
|
73
|
+
translationKey: PropTypes.string,
|
|
74
|
+
defaultValue: PropTypes.string,
|
|
75
|
+
}),
|
|
76
|
+
coming_soon: PropTypes.shape({
|
|
77
|
+
translationKey: PropTypes.string,
|
|
78
|
+
defaultValue: PropTypes.string,
|
|
79
|
+
}),
|
|
80
|
+
inactive: PropTypes.shape({
|
|
81
|
+
translationKey: PropTypes.string,
|
|
82
|
+
defaultValue: PropTypes.string,
|
|
83
|
+
}),
|
|
84
|
+
}),
|
|
85
|
+
icon: PropTypes.node,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export default OperatorCtaButton;
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
@mixin buttonsColor($color1, $color2, $color3, $textColor: 'white') {
|
|
2
2
|
display: inline-flex;
|
|
3
|
-
width: fit-content;
|
|
4
3
|
align-items: center;
|
|
5
4
|
justify-content: center;
|
|
5
|
+
text-align: center;
|
|
6
6
|
background-color: $color1;
|
|
7
7
|
color: $textColor;
|
|
8
|
+
padding: 0.9rem 3rem;
|
|
9
|
+
font-weight: 700;
|
|
10
|
+
font-size: 1.8rem;
|
|
11
|
+
border-radius: var(--border-radius);
|
|
12
|
+
|
|
13
|
+
>svg {
|
|
14
|
+
flex: none;
|
|
15
|
+
margin-left: .8rem;
|
|
16
|
+
}
|
|
8
17
|
|
|
9
18
|
&:hover {
|
|
10
19
|
background-color: $color2;
|
|
@@ -19,10 +28,12 @@
|
|
|
19
28
|
|
|
20
29
|
.primary {
|
|
21
30
|
@include buttonsColor(var(--primary-button-color, #5545A9), var(--primary-button-color-hover, #776ABA), var(--primary-button-color-active, #998FCB), var(--primary-button-color-text, #FFFFFF));
|
|
31
|
+
white-space: nowrap;
|
|
22
32
|
|
|
23
33
|
&.not_recommended,
|
|
24
34
|
&.coming_soon,
|
|
25
35
|
&.inactive {
|
|
36
|
+
white-space: normal;
|
|
26
37
|
background-color: #BBB5DD;
|
|
27
38
|
color: #776ABA;
|
|
28
39
|
}
|
|
@@ -30,10 +41,12 @@
|
|
|
30
41
|
|
|
31
42
|
.secondary {
|
|
32
43
|
@include buttonsColor(var(--secondary-button-color, #1C1A28), var(--secondary-button-color-hover, #33313D), var(--secondary-button-color-active, #3E3C47), var(--secondary-button-color-text, #FFFFFF));
|
|
44
|
+
white-space: nowrap;
|
|
33
45
|
|
|
34
46
|
&.not_recommended,
|
|
35
47
|
&.coming_soon,
|
|
36
48
|
&.inactive {
|
|
49
|
+
white-space: normal;
|
|
37
50
|
background-color: #6B6A72;
|
|
38
51
|
color: #3E3C47;
|
|
39
52
|
}
|
|
@@ -46,6 +59,7 @@
|
|
|
46
59
|
padding: 2.4rem 3.2rem;
|
|
47
60
|
background-color: white;
|
|
48
61
|
color: #1C1A28;
|
|
62
|
+
white-space: nowrap;
|
|
49
63
|
|
|
50
64
|
&:hover {
|
|
51
65
|
background-color: #1C1A28;
|
|
@@ -62,11 +76,18 @@
|
|
|
62
76
|
&.not_recommended,
|
|
63
77
|
&.coming_soon,
|
|
64
78
|
&.inactive {
|
|
79
|
+
white-space: normal;
|
|
65
80
|
border-color: #9C9AB0;
|
|
66
81
|
color: #9C9AB0;
|
|
67
82
|
}
|
|
68
83
|
}
|
|
69
84
|
|
|
85
|
+
.not_recommended,
|
|
86
|
+
.coming_soon,
|
|
87
|
+
.inactive{
|
|
88
|
+
padding: 1rem;
|
|
89
|
+
}
|
|
90
|
+
|
|
70
91
|
.xs_size {
|
|
71
92
|
padding: .4rem .8rem;
|
|
72
93
|
border-radius: 4px;
|
|
@@ -76,6 +97,7 @@
|
|
|
76
97
|
border-width: 1.5px;
|
|
77
98
|
|
|
78
99
|
>svg {
|
|
100
|
+
flex: none;
|
|
79
101
|
height: 0.8rem;
|
|
80
102
|
width: 0.8rem;
|
|
81
103
|
margin-left: .4rem;
|
|
@@ -91,6 +113,7 @@
|
|
|
91
113
|
border-width: 1.5px;
|
|
92
114
|
|
|
93
115
|
>svg {
|
|
116
|
+
flex: none;
|
|
94
117
|
height: 1.2rem;
|
|
95
118
|
width: 1.2rem;
|
|
96
119
|
margin-left: 1rem;
|
|
@@ -106,6 +129,7 @@
|
|
|
106
129
|
border-width: 2px;
|
|
107
130
|
|
|
108
131
|
>svg {
|
|
132
|
+
flex: none;
|
|
109
133
|
height: 1.4rem;
|
|
110
134
|
width: 1.4rem;
|
|
111
135
|
margin-left: 11px;
|
|
@@ -121,6 +145,7 @@
|
|
|
121
145
|
border-width: 2.5px;
|
|
122
146
|
|
|
123
147
|
>svg {
|
|
148
|
+
flex: none;
|
|
124
149
|
height: 1.6rem;
|
|
125
150
|
width: 1.6rem;
|
|
126
151
|
margin-left: 1.6rem;
|
|
@@ -136,6 +161,7 @@
|
|
|
136
161
|
border-width: 3px;
|
|
137
162
|
|
|
138
163
|
>svg {
|
|
164
|
+
flex: none;
|
|
139
165
|
height: 2rem;
|
|
140
166
|
width: 2rem;
|
|
141
167
|
margin-left: 1.8rem;
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
} from '@storybook/addon-docs/blocks';
|
|
10
10
|
import { IoMdArrowRoundForward } from '@react-icons/all-files/io/IoMdArrowRoundForward';
|
|
11
11
|
|
|
12
|
-
import
|
|
12
|
+
import OperatorCtaButton from '.';
|
|
13
13
|
|
|
14
14
|
export default {
|
|
15
|
-
title: 'Gatsby-Theme/Atoms/Operator CTA
|
|
16
|
-
component:
|
|
15
|
+
title: 'Gatsby-Theme/Atoms/Operator CTA Button',
|
|
16
|
+
component: OperatorCtaButton,
|
|
17
17
|
argTypes: {
|
|
18
18
|
operator: {
|
|
19
19
|
name: 'operator',
|
|
@@ -46,7 +46,7 @@ export default {
|
|
|
46
46
|
},
|
|
47
47
|
buttonSize: {
|
|
48
48
|
name: 'buttonType',
|
|
49
|
-
options: ['xs', 's', 'm', 'l', 'xl'],
|
|
49
|
+
options: ['xs', 's', 'm', 'l', 'xl', 'noSize'],
|
|
50
50
|
control: { type: 'radio' },
|
|
51
51
|
},
|
|
52
52
|
tracker: {
|
|
@@ -69,11 +69,11 @@ export default {
|
|
|
69
69
|
name: 'translationsObj',
|
|
70
70
|
type: { name: 'object' },
|
|
71
71
|
defaultValue: {
|
|
72
|
-
active: 'Visit',
|
|
73
|
-
not_recommended: 'Not Recommended',
|
|
74
|
-
coming_soon: 'Soon Available',
|
|
75
|
-
inactive: 'Not Accepting New Players',
|
|
76
|
-
blacklisted: 'Blacklisted',
|
|
72
|
+
active: { translationKey: 'play_now', defaultValue: 'Visit' },
|
|
73
|
+
not_recommended: { translationKey: 'not_recommended', defaultValue: 'Not Recommended' },
|
|
74
|
+
coming_soon: { translationKey: 'coming_soon', defaultValue: 'Soon Available' },
|
|
75
|
+
inactive: { translationKey: 'inactive', defaultValue: 'Not Accepting New Players' },
|
|
76
|
+
blacklisted: { translationKey: 'blacklisted', defaultValue: 'Blacklisted' },
|
|
77
77
|
},
|
|
78
78
|
},
|
|
79
79
|
},
|
|
@@ -94,7 +94,7 @@ export default {
|
|
|
94
94
|
},
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
const Template = (args) => <
|
|
97
|
+
const Template = (args) => <OperatorCtaButton {...args} />;
|
|
98
98
|
|
|
99
99
|
export const Default = Template.bind({});
|
|
100
100
|
Default.args = {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* eslint-disable no-lone-blocks */
|
|
2
|
+
/* eslint-disable no-unused-expressions */
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { render, cleanup } from '@testing-library/react';
|
|
5
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
6
|
+
|
|
7
|
+
import OperatorCtaButton from '.';
|
|
8
|
+
|
|
9
|
+
const data = (activeStatus = 'active') => ({
|
|
10
|
+
operator: {
|
|
11
|
+
status: activeStatus,
|
|
12
|
+
},
|
|
13
|
+
pageTemplate: 'default',
|
|
14
|
+
buttonType: 'primary',
|
|
15
|
+
buttonSize: 'm',
|
|
16
|
+
tracker: 'main',
|
|
17
|
+
translationsObj: {
|
|
18
|
+
active: { translationKey: 'play_now', defaultValue: 'Visit' },
|
|
19
|
+
not_recommended: { translationKey: 'not_recommended', defaultValue: 'Not Recommended' },
|
|
20
|
+
coming_soon: { translationKey: 'coming_soon', defaultValue: 'Soon Available' },
|
|
21
|
+
inactive: { translationKey: 'inactive', defaultValue: 'Not Accepting New Players' },
|
|
22
|
+
blacklisted: { translationKey: 'blacklisted', defaultValue: 'Blacklisted' },
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe('OperatorCtaButton Component', () => {
|
|
27
|
+
test('OperatorCtaButton with status active', () => {
|
|
28
|
+
const { getByText } = render(<OperatorCtaButton {...data()} />);
|
|
29
|
+
expect(getByText('Visit')).toBeTruthy();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('OperatorCtaButton with status inactive', () => {
|
|
33
|
+
const { getByText } = render(<OperatorCtaButton {...data('inactive')} />);
|
|
34
|
+
expect(getByText('Not Accepting New Players')).toBeTruthy();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('OperatorCtaButton with status not_recommended', () => {
|
|
38
|
+
const { getByText } = render(<OperatorCtaButton {...data('not_recommended')} />);
|
|
39
|
+
expect(getByText('Not Recommended')).toBeTruthy();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('OperatorCtaButton with status coming_soon', () => {
|
|
43
|
+
const { getByText } = render(<OperatorCtaButton {...data('coming_soon')} />);
|
|
44
|
+
expect(getByText('Soon Available')).toBeTruthy();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
afterEach(() => {
|
|
49
|
+
cleanup();
|
|
50
|
+
});
|
|
@@ -5,7 +5,7 @@ import { prettyTracker, imagePrettyUrl } from '~helpers/getters';
|
|
|
5
5
|
import LazyImage from '~hooks/lazy-image';
|
|
6
6
|
import isSticky from '~hooks/stickyOnScroll';
|
|
7
7
|
import Bonus from '~atoms/bonus';
|
|
8
|
-
import OperatorCta from '~atoms/operator-cta';
|
|
8
|
+
import OperatorCta from '~atoms/operator-cta-button';
|
|
9
9
|
import StarRating from '~molecules/star-rating';
|
|
10
10
|
import Tnc from '~molecules/tnc';
|
|
11
11
|
import { Context } from '~context/MainProvider';
|
|
@@ -6,7 +6,7 @@ import Bonus from '~atoms/bonus';
|
|
|
6
6
|
import SellingPoints from '~atoms/selling-points';
|
|
7
7
|
import StarRating from '~molecules/star-rating/one-star';
|
|
8
8
|
import ReviewLink from '../../../atoms/review-link';
|
|
9
|
-
import OperatorCta from '~atoms/operator-cta';
|
|
9
|
+
import OperatorCta from '~atoms/operator-cta-button';
|
|
10
10
|
import { prettyTracker, imagePrettyUrl, getAltText } from '~helpers/getters';
|
|
11
11
|
import LazyImage from '~hooks/lazy-image';
|
|
12
12
|
|
|
@@ -8,6 +8,7 @@ export default {
|
|
|
8
8
|
'Irishluck.ie': ['cards', 'cards_v2'],
|
|
9
9
|
'norskespilleautomater.com': ['cards', 'cards_v2'],
|
|
10
10
|
'playcasino.co.za': ['cards', 'cards_v2'],
|
|
11
|
+
'sporttheme.com': ['cards', 'cards_v2'],
|
|
11
12
|
},
|
|
12
13
|
filter_cards_modules: {
|
|
13
14
|
'irishluck.ie': ['inactive', 'blacklisted'],
|
|
@@ -15,6 +16,7 @@ export default {
|
|
|
15
16
|
'playcasino.co.za': ['inactive', 'blacklisted'],
|
|
16
17
|
'onlinegamblingsa.co.za': ['inactive', 'blacklisted'],
|
|
17
18
|
'onlinegamblingsa.com': ['inactive', 'blacklisted'],
|
|
19
|
+
'sporttheme.com': ['inactive', 'blacklisted'],
|
|
18
20
|
},
|
|
19
21
|
keep_page_extra_fields: {
|
|
20
22
|
operator: {
|
|
@@ -311,7 +311,9 @@ export default {
|
|
|
311
311
|
// add sports data
|
|
312
312
|
if (rageSportType) {
|
|
313
313
|
// should be able to check for site type here (type: sport)
|
|
314
|
-
page.
|
|
314
|
+
if (page.type !== 'operator') {
|
|
315
|
+
page.relation = addSportsDataToPage(sportsData, page, themeType);
|
|
316
|
+
}
|
|
315
317
|
|
|
316
318
|
if (pageType === 'page' && page.relation.showcased_events) {
|
|
317
319
|
const eventPages = Object.values(transformedPages[market].event);
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Context } from '~context/MainProvider';
|
|
4
|
-
import { prettyTracker, translate } from '~helpers/getters';
|
|
5
|
-
|
|
6
|
-
import styles from './operator-cta-two.module.scss';
|
|
7
|
-
|
|
8
|
-
const OperatorCtaTwo = ({
|
|
9
|
-
operator,
|
|
10
|
-
pageTemplate,
|
|
11
|
-
gtmClass = '',
|
|
12
|
-
buttonType = 'primary',
|
|
13
|
-
buttonSize = 'm',
|
|
14
|
-
tracker = 'main',
|
|
15
|
-
icon = null,
|
|
16
|
-
translationsObj = {
|
|
17
|
-
active: 'Visit',
|
|
18
|
-
not_recommended: 'Not Recommended',
|
|
19
|
-
coming_soon: 'Soon Available',
|
|
20
|
-
inactive: 'Not Accepting New Players',
|
|
21
|
-
blacklisted: 'Blacklisted',
|
|
22
|
-
},
|
|
23
|
-
}) => {
|
|
24
|
-
const { translations } = useContext(Context) || {};
|
|
25
|
-
const status = operator?.status || '';
|
|
26
|
-
const trackerType = tracker?.toLowerCase()?.replace(' ', '_');
|
|
27
|
-
const prettyLink = prettyTracker(operator, trackerType, false, pageTemplate);
|
|
28
|
-
const textkey = `${status}_cta`;
|
|
29
|
-
|
|
30
|
-
const translateBtn = translate(translations, textkey, translationsObj[status] || '');
|
|
31
|
-
|
|
32
|
-
const classes = `${styles[buttonType]} ${styles[`${buttonSize}_size`]} ${styles[status]}`;
|
|
33
|
-
|
|
34
|
-
const inactive = ['coming_soon', 'inactive'].includes(status);
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<a
|
|
38
|
-
{...(!inactive ? { href: prettyLink } : {})}
|
|
39
|
-
title={typeof translateBtn === 'string' ? translateBtn : ''}
|
|
40
|
-
aria-label={typeof translateBtn === 'string' ? translateBtn : ''}
|
|
41
|
-
className={`${classes} ${gtmClass}`}
|
|
42
|
-
{...(!inactive ? { target: '_blank' } : {})}
|
|
43
|
-
{...(!inactive ? { rel: 'nofollow noreferrer' } : {})}
|
|
44
|
-
>
|
|
45
|
-
{translateBtn}
|
|
46
|
-
{icon && icon}
|
|
47
|
-
</a>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
OperatorCtaTwo.propTypes = {
|
|
52
|
-
operator: PropTypes.shape({
|
|
53
|
-
name: PropTypes.string,
|
|
54
|
-
status: PropTypes.string,
|
|
55
|
-
}),
|
|
56
|
-
gtmClass: PropTypes.string,
|
|
57
|
-
pageTemplate: PropTypes.string,
|
|
58
|
-
buttonSize: PropTypes.string,
|
|
59
|
-
buttonType: PropTypes.string,
|
|
60
|
-
tracker: PropTypes.string,
|
|
61
|
-
translationsObj: PropTypes.shape({
|
|
62
|
-
active: PropTypes.string,
|
|
63
|
-
not_recommended: PropTypes.string,
|
|
64
|
-
coming_soon: PropTypes.string,
|
|
65
|
-
inactive: PropTypes.string,
|
|
66
|
-
}),
|
|
67
|
-
icon: PropTypes.node,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export default OperatorCtaTwo;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-lone-blocks */
|
|
2
|
-
/* eslint-disable no-unused-expressions */
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { render, cleanup } from '@testing-library/react';
|
|
5
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
6
|
-
|
|
7
|
-
import OperatorCtaTwo from '.';
|
|
8
|
-
|
|
9
|
-
const data = (activeStatus = 'active') => ({
|
|
10
|
-
operator: {
|
|
11
|
-
status: activeStatus,
|
|
12
|
-
},
|
|
13
|
-
pageTemplate: 'default',
|
|
14
|
-
buttonType: 'primary',
|
|
15
|
-
buttonSize: 'm',
|
|
16
|
-
tracker: 'main',
|
|
17
|
-
translationsObj: {
|
|
18
|
-
active: 'Visit',
|
|
19
|
-
not_recommended: 'Not Recommended',
|
|
20
|
-
coming_soon: 'Soon Available',
|
|
21
|
-
inactive: 'Not Accepting New Players',
|
|
22
|
-
blacklisted: 'Blacklisted',
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe('OperatorCtaTwo Component', () => {
|
|
27
|
-
test('OperatorCtaTwo with status active', () => {
|
|
28
|
-
const { getByText } = render(<OperatorCtaTwo {...data()} />);
|
|
29
|
-
expect(getByText('Visit')).toBeTruthy();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
test('OperatorCtaTwo with status inactive', () => {
|
|
33
|
-
const { getByText } = render(<OperatorCtaTwo {...data('inactive')} />);
|
|
34
|
-
expect(getByText('Not Accepting New Players')).toBeTruthy();
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('OperatorCtaTwo with status not_recommended', () => {
|
|
38
|
-
const { getByText } = render(<OperatorCtaTwo {...data('not_recommended')} />);
|
|
39
|
-
expect(getByText('Not Recommended')).toBeTruthy();
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test('OperatorCtaTwo with status coming_soon', () => {
|
|
43
|
-
const { getByText } = render(<OperatorCtaTwo {...data('coming_soon')} />);
|
|
44
|
-
expect(getByText('Soon Available')).toBeTruthy();
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
afterEach(() => {
|
|
49
|
-
cleanup();
|
|
50
|
-
});
|