gatsby-core-theme 18.0.2 → 18.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.
- package/CHANGELOG.md +30 -0
- package/package.json +1 -1
- package/src/components/atoms/operator-cta/index.js +3 -0
- package/src/components/atoms/review-link/index.js +37 -0
- package/src/components/atoms/review-link/reviewLink.test.js +34 -0
- package/src/components/molecules/star-rating/one-star.js +3 -2
- package/src/components/molecules/star-rating/one-star.module.scss +1 -1
- package/src/components/molecules/star-rating/one-star.test.js +2 -1
- package/src/components/molecules/toplist/default-row/index.js +10 -11
- package/src/helpers/getters.js +6 -0
- package/src/helpers/getters.test.js +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
## [18.0.4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v18.0.3...v18.0.4) (2023-01-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update reviewLink and default-row ([0ff2327](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0ff232795cfa6d11c89d32bdcf5b744a88cf1f5b))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
* Merge branch 'tm-3138-changing-operator-review-text-on-modules' into 'master' ([323ded9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/323ded9c91ad98cb768f28277b7d11382aa00e9b))
|
|
10
|
+
|
|
11
|
+
## [18.0.3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v18.0.2...v18.0.3) (2023-01-24)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* add new review component and tests ([5740902](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5740902d6efff14e537980fa534f1124b578f8a4))
|
|
17
|
+
* default value ([f6cc6bc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f6cc6bcf584c9e82a9a90d5c17967f7a9a6a67e6))
|
|
18
|
+
* getters test ([080bfbf](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/080bfbf6942b1f54674101832e7e86bda5d7e77a))
|
|
19
|
+
* one-star ([f65156f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f65156f6891687a8ce401bee6e7a885dd4cea5c7))
|
|
20
|
+
* one-star ([ae348f2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ae348f2886054f1708275b83b0b0c92fc6432b40))
|
|
21
|
+
* operator header core ([020ab5d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/020ab5d850a40eb46899676ceff85ed18607282b))
|
|
22
|
+
* remove one-star css ([01beecf](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/01beecfd20df4842065efc26fdb76203afe66a61))
|
|
23
|
+
* review link in toplist ([5d76d5e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5d76d5ee80c5664b5942b96d4e26d89d1710a8e2))
|
|
24
|
+
* typo ([e4e4dae](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e4e4dae91590a90b3af93d86fdbce6f15c3383ec))
|
|
25
|
+
* update name of reviewLink component and update the if with include ([31af320](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/31af3202d2f7f04c068601c81a2c69e683f1ee78))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
* Merge branch 'tm-3138-changing-operator-review-text-on-modules' into 'master' ([423c965](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/423c96599ff4834fc26cfef1969decacf8eb8eb0))
|
|
29
|
+
* Merge branch 'tm-3253-operator-header' into 'master' ([5f3da13](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5f3da135c36b4e39e08f4856730111fa5aaa990b))
|
|
30
|
+
|
|
1
31
|
## [18.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v18.0.1...v18.0.2) (2023-01-17)
|
|
2
32
|
|
|
3
33
|
|
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ export default function OperatorCta({
|
|
|
17
17
|
gtmClass = '',
|
|
18
18
|
tertiary = false,
|
|
19
19
|
pageTemplate,
|
|
20
|
+
icon,
|
|
20
21
|
}) {
|
|
21
22
|
const { translations } = useContext(Context) || {};
|
|
22
23
|
const status = operator?.status;
|
|
@@ -51,6 +52,7 @@ export default function OperatorCta({
|
|
|
51
52
|
isInternalLink={false}
|
|
52
53
|
gtmClass={`${gtmClass} operator-cta-gtm btn-cta`}
|
|
53
54
|
tertiary={tertiary}
|
|
55
|
+
icon={icon}
|
|
54
56
|
/>
|
|
55
57
|
);
|
|
56
58
|
};
|
|
@@ -67,4 +69,5 @@ OperatorCta.propTypes = {
|
|
|
67
69
|
playText: PropTypes.string,
|
|
68
70
|
closedCasinoText: PropTypes.string,
|
|
69
71
|
gtmClass: PropTypes.string,
|
|
72
|
+
icon: PropTypes.func,
|
|
70
73
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Context } from 'gatsby-core-theme/src/context/MainProvider';
|
|
4
|
+
import { translate } from 'gatsby-core-theme/src/helpers/getters';
|
|
5
|
+
import Link from 'gatsby-core-theme/src/hooks/link';
|
|
6
|
+
|
|
7
|
+
const ReviewLink = ({ template, itemName, reviewPath, className }) => {
|
|
8
|
+
let isBonusTemplate = false;
|
|
9
|
+
const { translations } = useContext(Context) || {};
|
|
10
|
+
|
|
11
|
+
if (['free_bonuses', 'bonus_pages', 'casino_bonus'].includes(template)) {
|
|
12
|
+
isBonusTemplate = true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Link className={className} to={reviewPath}>{`${
|
|
17
|
+
isBonusTemplate
|
|
18
|
+
? translate(translations, 'bonus', '[operator_name] Bonus').replace(
|
|
19
|
+
'[operator_name]',
|
|
20
|
+
itemName
|
|
21
|
+
)
|
|
22
|
+
: translate(translations, 'read_review', '[operator_name] Review').replace(
|
|
23
|
+
'[operator_name]',
|
|
24
|
+
itemName
|
|
25
|
+
)
|
|
26
|
+
}`}</Link>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
ReviewLink.propTypes = {
|
|
31
|
+
template: PropTypes.string,
|
|
32
|
+
itemName: PropTypes.string,
|
|
33
|
+
reviewPath: PropTypes.string,
|
|
34
|
+
className: PropTypes.string,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default ReviewLink;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, cleanup } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
4
|
+
import ReviewLink from '.';
|
|
5
|
+
|
|
6
|
+
describe('ReviewLink', () => {
|
|
7
|
+
it('renders the correct text for the "bonus" template', () => {
|
|
8
|
+
const { getByText } = render(
|
|
9
|
+
<ReviewLink template="bonus_pages" itemName="Super Slot" reviewPath="/review" />
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
expect(getByText('Super Slot Bonus')).toBeInTheDocument();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('renders the correct text for the "review" template', () => {
|
|
16
|
+
const { getByText } = render(
|
|
17
|
+
<ReviewLink template="review_pages" itemName="Super Slot" reviewPath="/review" />
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
expect(getByText('Super Slot Review')).toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('renders the correct link path', () => {
|
|
24
|
+
const { container } = render(
|
|
25
|
+
<ReviewLink template="review_pages" itemName="Super Slot" reviewPath="/review" />
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
expect(container.querySelector('a').getAttribute('href')).toBe('/review');
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
afterEach(() => {
|
|
33
|
+
cleanup();
|
|
34
|
+
});
|
|
@@ -6,14 +6,15 @@ import { translate } from '~helpers/getters';
|
|
|
6
6
|
|
|
7
7
|
import styles from './one-star.module.scss';
|
|
8
8
|
|
|
9
|
-
const OneStar = ({
|
|
9
|
+
const OneStar = ({ rating, numOfStars = 5, active = true, showLabel = false }) => {
|
|
10
10
|
const { translations } = useContext(Context) || {};
|
|
11
11
|
|
|
12
12
|
return (
|
|
13
13
|
<div className={`${styles.starRatingContainer} ${!active && styles.inactive}`}>
|
|
14
14
|
{showLabel && translate(translations, 'rating', 'Rating')}
|
|
15
15
|
<span className={styles.fullStar} />
|
|
16
|
-
{`${getRating(rating)}
|
|
16
|
+
{`${getRating(rating)}/`}
|
|
17
|
+
<span>{numOfStars}</span>
|
|
17
18
|
</div>
|
|
18
19
|
);
|
|
19
20
|
};
|
|
@@ -9,7 +9,8 @@ describe('OneStar Component', () => {
|
|
|
9
9
|
const { getByText } = render(<OneStar showLabel numOfStars={5} rating={3} />);
|
|
10
10
|
|
|
11
11
|
expect(getByText('Rating', { exact: false })).toBeTruthy();
|
|
12
|
-
expect(getByText('3/
|
|
12
|
+
expect(getByText('3/', { exact: false })).toBeTruthy();
|
|
13
|
+
expect(getByText('5', { exact: false })).toBeTruthy();
|
|
13
14
|
});
|
|
14
15
|
});
|
|
15
16
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
2
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
3
|
-
import React
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import Bonus from '~atoms/bonus';
|
|
6
|
-
import { Context } from '~context/MainProvider';
|
|
7
6
|
import SellingPoints from '~atoms/selling-points';
|
|
8
7
|
import StarRating from '~molecules/star-rating/one-star';
|
|
9
|
-
import
|
|
8
|
+
import ReviewLink from '../../../atoms/review-link';
|
|
10
9
|
import OperatorCta from '~atoms/operator-cta';
|
|
11
|
-
import { prettyTracker, imagePrettyUrl,
|
|
10
|
+
import { prettyTracker, imagePrettyUrl, getAltText } from '~helpers/getters';
|
|
12
11
|
import LazyImage from '~hooks/lazy-image';
|
|
13
12
|
|
|
14
13
|
import styles from './default-row.module.scss';
|
|
@@ -25,7 +24,7 @@ const Row = ({
|
|
|
25
24
|
}) => {
|
|
26
25
|
const prettyLink = prettyTracker(item, 'main', false, pageTemplate);
|
|
27
26
|
const itemRating = item.rating;
|
|
28
|
-
const
|
|
27
|
+
const reviewPath = item.review_link ? `/${item.review_link}` : item.path || '/';
|
|
29
28
|
|
|
30
29
|
const imageObject = item?.standardised_logo_url_object || item?.logo_url_object;
|
|
31
30
|
|
|
@@ -57,7 +56,6 @@ const Row = ({
|
|
|
57
56
|
width={100}
|
|
58
57
|
height={100}
|
|
59
58
|
/>
|
|
60
|
-
{item.name}
|
|
61
59
|
</a>
|
|
62
60
|
<a
|
|
63
61
|
href={prettyLink}
|
|
@@ -69,11 +67,12 @@ const Row = ({
|
|
|
69
67
|
</a>
|
|
70
68
|
<StarRating numOfStars={5} rating={itemRating} showLabel />
|
|
71
69
|
<SellingPoints sellingPoints={item.selling_points} />
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
<ReviewLink
|
|
71
|
+
className={`${styles.reviewLink} toplist-variant-one-gtm`}
|
|
72
|
+
template={pageTemplate}
|
|
73
|
+
itemName={item.name}
|
|
74
|
+
reviewPath={reviewPath}
|
|
75
|
+
/>
|
|
77
76
|
<div>
|
|
78
77
|
<OperatorCta
|
|
79
78
|
operator={item}
|
package/src/helpers/getters.js
CHANGED
|
@@ -391,3 +391,9 @@ export const getRoundMinutes = (time) => {
|
|
|
391
391
|
export function getAltText(imageObject, defaultAlt = 'missing alt') {
|
|
392
392
|
return imageObject && imageObject.alt ? imageObject.alt : defaultAlt;
|
|
393
393
|
}
|
|
394
|
+
|
|
395
|
+
export function getObjectValue(obj, path) {
|
|
396
|
+
if (!path) return obj;
|
|
397
|
+
const properties = path.split('.');
|
|
398
|
+
return getObjectValue(obj[properties.shift()], properties.join('.'));
|
|
399
|
+
}
|
|
@@ -302,4 +302,19 @@ describe('Getters Helper', () => {
|
|
|
302
302
|
const altText = Getters.getAltText(null, 'default');
|
|
303
303
|
expect(altText).toEqual('default');
|
|
304
304
|
});
|
|
305
|
+
|
|
306
|
+
test('getObjectvalue recursive function to get value', () => {
|
|
307
|
+
const getObjValue = Getters.getObjectValue({ name: 'test' }, 'name');
|
|
308
|
+
expect(getObjValue).toEqual('test');
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
test('getObjectvalue recursive function to get 2 times nested value', () => {
|
|
312
|
+
const getObjValue = Getters.getObjectValue({ test: { test2: 'test3' } }, 'test.test2');
|
|
313
|
+
expect(getObjValue).toEqual('test3');
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
test('getObjectvalue recursive function no path it will return the object', () => {
|
|
317
|
+
const getObjValue = Getters.getObjectValue({ name: 'test' });
|
|
318
|
+
expect(getObjValue).toEqual({ name: 'test' });
|
|
319
|
+
});
|
|
305
320
|
});
|