gatsby-core-theme 7.0.0 → 7.0.1
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 +33 -0
- package/gatsby-node.esm.js +1 -0
- package/package.json +1 -1
- package/src/components/atoms/author/author.module.scss +14 -2
- package/src/components/atoms/author/author.test.js +1 -1
- package/src/components/atoms/author/index.js +58 -32
- package/src/components/atoms/author-box/index.js +3 -2
- package/src/components/atoms/spotlights/index.js +2 -3
- package/src/components/molecules/carousel/default-slide/index.js +2 -2
- package/src/components/molecules/header/header.module.scss +12 -3
- package/src/components/molecules/header/header.test.js +1 -1
- package/src/components/molecules/header/index.js +2 -9
- package/src/components/molecules/link-list/index.js +2 -2
- package/src/components/molecules/star-rating/one-star.js +17 -7
- package/src/components/molecules/star-rating/one-star.module.scss +14 -13
- package/src/components/molecules/toplist/default-row/index.js +15 -7
- package/src/components/organisms/head/index.js +1 -4
- package/src/constants/pick-keys.js +7 -2
- package/src/helpers/getters.js +4 -0
- package/src/helpers/getters.test.js +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
## [7.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v7.0.0...v7.0.1) (2022-05-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add alt from image_object ([c1e7c23](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c1e7c232bbc41b250d99104feaa7ec248408bf50))
|
|
7
|
+
* add alt text, and also for operator added object logo_url_object ([64b0313](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/64b0313acc9e505191395b36896bf1886992b4f4))
|
|
8
|
+
* add image_object for payment and software ([f848229](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f84822911c11c053f92e5a16cf80542a13781ffb))
|
|
9
|
+
* add tests ([467919e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/467919e5b0f2b0ead4bdfb122d4c8278c9c2b0df))
|
|
10
|
+
* added standardized logo attribute and added label in rating component ([7bf1cbe](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7bf1cbe9e15e91e210840bd32237f07bb90f7453))
|
|
11
|
+
* fix error ([77e329d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/77e329d348be706dc040f28985e579cb4f29ff9b))
|
|
12
|
+
* fix error ([736f9ec](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/736f9ec86df1f2d09a0597002551efb198138538))
|
|
13
|
+
* tests fixes ([0972b4d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0972b4d37d368c5eef1d77b891b9ec531fa61254))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Code Refactoring
|
|
17
|
+
|
|
18
|
+
* remove archive robot_options and update head meta robots ([b0f5e6c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b0f5e6ce03fa7bc07d5966351f7a40b41eee922a))
|
|
19
|
+
* reorder author component ([282243f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/282243fdd41f2e1e70d2c04b76a3f1901a1a0d9b))
|
|
20
|
+
* update archive robot_options ([9adf990](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9adf990fca081bed88eea6c2444fb39ed5fd36b2))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
* Merge branch 'tm-2834-logos-rating' into 'master' ([34e951b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/34e951b45c41cf37bd3acd99d0171819c40875ed))
|
|
24
|
+
* Merge branch 'tm-2801-fact-checker' into 'master' ([55eda9f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/55eda9f01ef37f388168fcd7abab21fdd82fbc71))
|
|
25
|
+
* Merge branch 'tm-2829-image-alt-text' into 'master' ([47ca5e5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/47ca5e5aa7d45df9ee7922aecc8ee05ef73f5d68))
|
|
26
|
+
* Merge branch 'tm-2831-update-archive-noindex-nofollow' into 'master' ([c5a42f2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c5a42f21ab694af4c3d27c779fe1fc247bd2bdcb))
|
|
27
|
+
* Merge branch 'tm-2829-image-alt-text' into 'master' ([9297107](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9297107e6e2667529c812d798ebbd99841be969f))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Tests
|
|
31
|
+
|
|
32
|
+
* changes to test scripts ([8a7d401](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8a7d401eeda89e344fa8d54663fa759e80cb1cba))
|
|
33
|
+
|
|
1
34
|
# [7.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.9...v7.0.0) (2022-05-03)
|
|
2
35
|
|
|
3
36
|
|
package/gatsby-node.esm.js
CHANGED
|
@@ -72,6 +72,7 @@ function createArchivePage(pageObject, marketSections, prefilledModules, createP
|
|
|
72
72
|
? pageObject.path
|
|
73
73
|
: `${pageObject.path}/page/${archive.currentPage}`;
|
|
74
74
|
page.sections.main.modules[archiveModuleIndex] = archive;
|
|
75
|
+
|
|
75
76
|
createPage({
|
|
76
77
|
path: page.path,
|
|
77
78
|
component: require.resolve(appName),
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
.authorInfo {
|
|
2
2
|
font-size: 1.5rem;
|
|
3
|
-
margin-right: 2rem;
|
|
4
3
|
}
|
|
5
4
|
.date {
|
|
6
5
|
font-size: 1.5rem;
|
|
@@ -10,7 +9,7 @@
|
|
|
10
9
|
font-size: 1.8rem;
|
|
11
10
|
}
|
|
12
11
|
.authorIcon,
|
|
13
|
-
.
|
|
12
|
+
.dateTimeWrapper,
|
|
14
13
|
.authorInfo {
|
|
15
14
|
height: 2rem;
|
|
16
15
|
display: inline-block;
|
|
@@ -20,3 +19,16 @@
|
|
|
20
19
|
color: #09f;
|
|
21
20
|
}
|
|
22
21
|
}
|
|
22
|
+
|
|
23
|
+
.authorWrapper {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
column-gap: 0.5rem;
|
|
27
|
+
|
|
28
|
+
> div {
|
|
29
|
+
display: flex;
|
|
30
|
+
justify-content: flex-end;
|
|
31
|
+
flex-wrap: wrap;
|
|
32
|
+
column-gap: 0.5rem;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -37,7 +37,7 @@ describe('Author Component', () => {
|
|
|
37
37
|
date="2020-04-24 15:37:42"
|
|
38
38
|
/>
|
|
39
39
|
);
|
|
40
|
-
expect(container.querySelector('.
|
|
40
|
+
expect(container.querySelector('.dateTimeWrapper')).toBeTruthy();
|
|
41
41
|
const info = getByText('with mohsen');
|
|
42
42
|
expect(info).toBeTruthy();
|
|
43
43
|
expect(container.querySelector('i')).toBeTruthy();
|
|
@@ -15,42 +15,66 @@ const Author = ({
|
|
|
15
15
|
date = '',
|
|
16
16
|
dateFormat = 'DD.MM.YYYY',
|
|
17
17
|
dateSeparator = '.',
|
|
18
|
+
readingTime = '',
|
|
19
|
+
reviewer = {},
|
|
18
20
|
}) => {
|
|
19
21
|
return (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
<div className={styles.authorWrapper}>
|
|
23
|
+
<div>
|
|
24
|
+
{link && icon && (
|
|
25
|
+
<div className={styles.authorIcon}>
|
|
26
|
+
<a
|
|
27
|
+
href={link}
|
|
28
|
+
target="_blank"
|
|
29
|
+
rel="noreferrer"
|
|
30
|
+
aria-label={`${name} Link`}
|
|
31
|
+
className="author-gtm"
|
|
32
|
+
>
|
|
33
|
+
{icon}
|
|
34
|
+
</a>
|
|
35
|
+
</div>
|
|
36
|
+
)}
|
|
37
|
+
{!link && icon && <div className={styles.authorIcon}>{icon}</div>}
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
<div className={styles.authorInfo}>
|
|
40
|
+
{name &&
|
|
41
|
+
(authorProfile ? (
|
|
42
|
+
<>
|
|
43
|
+
{`${prefix} `}
|
|
44
|
+
<Link to={authorProfile} className="author-gtm" title={name}>
|
|
45
|
+
{name}
|
|
46
|
+
</Link>
|
|
47
|
+
</>
|
|
48
|
+
) : (
|
|
49
|
+
`${prefix} ${name}`
|
|
50
|
+
))}
|
|
51
|
+
</div>
|
|
52
|
+
{readingTime && (
|
|
53
|
+
<div className={date && styles.readingWithBorder}>
|
|
54
|
+
<span>Reading time</span>
|
|
55
|
+
{` ${readingTime} min`}
|
|
56
|
+
</div>
|
|
57
|
+
)}
|
|
48
58
|
</div>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
<div>
|
|
60
|
+
{reviewer.name && (
|
|
61
|
+
<div className={date && styles.reviewer}>
|
|
62
|
+
<span>Fact checked by</span>
|
|
63
|
+
{` `}
|
|
64
|
+
<Link to={reviewer.profile_page_path} title={reviewer.name}>
|
|
65
|
+
{reviewer.name}
|
|
66
|
+
</Link>
|
|
67
|
+
</div>
|
|
68
|
+
)}
|
|
69
|
+
{date && (
|
|
70
|
+
<div className={styles.dateTimeWrapper}>
|
|
71
|
+
<span>Published on</span>
|
|
72
|
+
{` `}
|
|
73
|
+
{formatDate(date, dateFormat, dateSeparator, 'en-GB')}
|
|
74
|
+
</div>
|
|
75
|
+
)}
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
54
78
|
);
|
|
55
79
|
};
|
|
56
80
|
|
|
@@ -63,6 +87,8 @@ Author.propTypes = {
|
|
|
63
87
|
date: PropTypes.string,
|
|
64
88
|
dateFormat: PropTypes.string,
|
|
65
89
|
dateSeparator: PropTypes.string,
|
|
90
|
+
readingTime: PropTypes.string,
|
|
91
|
+
reviewer: PropTypes.shape({}),
|
|
66
92
|
};
|
|
67
93
|
|
|
68
94
|
export default Author;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
3
|
import { FaInstagram, FaFacebookSquare, FaTwitter, FaLinkedin } from 'react-icons/fa';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import { translate, imagePrettyUrl } from '~helpers/getters';
|
|
5
|
+
import { translate, imagePrettyUrl, getAltText } from '~helpers/getters';
|
|
6
6
|
import styles from './author-box.module.scss';
|
|
7
7
|
import LazyImage from '~hooks/lazy-image';
|
|
8
8
|
import Link from '~hooks/link';
|
|
@@ -24,7 +24,7 @@ export default function AuthorBox({ author }) {
|
|
|
24
24
|
{author.image_object && (
|
|
25
25
|
<LazyImage
|
|
26
26
|
src={imagePrettyUrl(author.image_object.filename)}
|
|
27
|
-
alt={author.image_alt || author.name}
|
|
27
|
+
alt={getAltText(author?.image_object, author.image_alt || author.name)}
|
|
28
28
|
width={author.image_object?.width}
|
|
29
29
|
height={author.image_object?.height}
|
|
30
30
|
/>
|
|
@@ -110,6 +110,7 @@ AuthorBox.propTypes = {
|
|
|
110
110
|
width: PropTypes.number,
|
|
111
111
|
height: PropTypes.number,
|
|
112
112
|
filename: PropTypes.string,
|
|
113
|
+
alt: PropTypes.string,
|
|
113
114
|
}),
|
|
114
115
|
image_alt: PropTypes.string,
|
|
115
116
|
name: PropTypes.string,
|
|
@@ -7,7 +7,7 @@ import { GrFormNextLink } from 'react-icons/gr';
|
|
|
7
7
|
import Button from '~atoms/button';
|
|
8
8
|
import LazyImage from '~hooks/lazy-image';
|
|
9
9
|
import keygen from '~helpers/keygen';
|
|
10
|
-
import { imagePrettyUrl, getImageFilename } from '~helpers/getters';
|
|
10
|
+
import { imagePrettyUrl, getImageFilename, getAltText } from '~helpers/getters';
|
|
11
11
|
import Link from '~hooks/link';
|
|
12
12
|
import styles from './spotlights.module.scss';
|
|
13
13
|
|
|
@@ -18,14 +18,13 @@ const Spotlights = ({ module, themeStyles = {} }) => {
|
|
|
18
18
|
const img = mode === 'icon' ? item.icon : item.image;
|
|
19
19
|
const imageSrc = imagePrettyUrl(img);
|
|
20
20
|
const fileName = getImageFilename(imageSrc);
|
|
21
|
-
|
|
22
21
|
return (
|
|
23
22
|
<>
|
|
24
23
|
{img && (
|
|
25
24
|
<LazyImage
|
|
26
25
|
width={100}
|
|
27
26
|
height={50}
|
|
28
|
-
alt={item.label || item?.link_text || fileName}
|
|
27
|
+
alt={getAltText(item?.image_object, item.label || item?.link_text || fileName)}
|
|
29
28
|
src={imageSrc}
|
|
30
29
|
/>
|
|
31
30
|
)}
|
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
|
|
6
6
|
import LazyImage from '~hooks/lazy-image';
|
|
7
|
-
import { imagePrettyUrl } from '~helpers/getters';
|
|
7
|
+
import { imagePrettyUrl, getAltText } from '~helpers/getters';
|
|
8
8
|
import Button from '~atoms/button';
|
|
9
9
|
import styles from './default-slide.module.scss';
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@ const Slide = ({
|
|
|
22
22
|
<LazyImage
|
|
23
23
|
className={styles.image}
|
|
24
24
|
src={imagePrettyUrl(item.image, imageSizes.width, imageSizes.height)}
|
|
25
|
-
alt={item.title || slideTitle}
|
|
25
|
+
alt={getAltText(item?.image_object, item.title || slideTitle)}
|
|
26
26
|
/>
|
|
27
27
|
)}
|
|
28
28
|
{item.content && <p className={styles.content}>{item.content}</p>}
|
|
@@ -26,9 +26,18 @@
|
|
|
26
26
|
z-index: 1;
|
|
27
27
|
padding: 2.4rem;
|
|
28
28
|
|
|
29
|
-
.
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
.topSection {
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
|
|
33
|
+
> div {
|
|
34
|
+
padding-top: 1rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.readingTime {
|
|
38
|
+
> span {
|
|
39
|
+
font-weight: bold;
|
|
40
|
+
}
|
|
32
41
|
}
|
|
33
42
|
}
|
|
34
43
|
}
|
|
@@ -14,7 +14,7 @@ describe('header component', () => {
|
|
|
14
14
|
expect(container.querySelectorAll('.headerContent')).toHaveLength(1);
|
|
15
15
|
|
|
16
16
|
// Inner HTML
|
|
17
|
-
expect(container.querySelectorAll('p')).toHaveLength(
|
|
17
|
+
expect(container.querySelectorAll('p')).toHaveLength(1);
|
|
18
18
|
expect(container.querySelectorAll('i')).toHaveLength(1);
|
|
19
19
|
|
|
20
20
|
// Testing image
|
|
@@ -62,6 +62,8 @@ function Header({ section, content = null, backgroundImage = true }) {
|
|
|
62
62
|
authorProfile={section.page.author?.profile_page_path}
|
|
63
63
|
name={section.page.author?.name}
|
|
64
64
|
date={section.page.updated_at ? section.page.updated_at : section.page.created_at}
|
|
65
|
+
readingTime={section.page.reading_time}
|
|
66
|
+
reviewer={section.page.reviewer}
|
|
65
67
|
/>
|
|
66
68
|
</div>
|
|
67
69
|
)}
|
|
@@ -72,15 +74,6 @@ function Header({ section, content = null, backgroundImage = true }) {
|
|
|
72
74
|
section.page.template !== 'article_casino' &&
|
|
73
75
|
section.page.template !== 'article_sports' &&
|
|
74
76
|
section.page.template !== 'game_review' && <h1>{section.page.title}</h1>}
|
|
75
|
-
<p className={styles.readingTime}>
|
|
76
|
-
Reading Time: <span>{section.page.reading_time}</span>
|
|
77
|
-
</p>
|
|
78
|
-
{section.page.reviewer && (
|
|
79
|
-
<p className={styles.readingTime}>
|
|
80
|
-
Fact checked by:{' '}
|
|
81
|
-
<a href={section.page.reviewer.profile_page_path}>{section.page.reviewer.name}</a>
|
|
82
|
-
</p>
|
|
83
|
-
)}
|
|
84
77
|
<div className={!content && styles.headerText}>{headerContent()}</div>
|
|
85
78
|
</div>
|
|
86
79
|
</header>
|
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
|
|
6
6
|
import keygen from '~helpers/keygen';
|
|
7
|
-
import { imagePrettyUrl } from '~helpers/getters';
|
|
7
|
+
import { imagePrettyUrl, getAltText } from '~helpers/getters';
|
|
8
8
|
import Link from '~hooks/link';
|
|
9
9
|
import LazyImage from '~hooks/lazy-image';
|
|
10
10
|
|
|
@@ -29,7 +29,7 @@ const LinkList = ({
|
|
|
29
29
|
const LinkImage = () => (
|
|
30
30
|
<LazyImage
|
|
31
31
|
src={imagePrettyUrl(item.image)}
|
|
32
|
-
alt={item.title}
|
|
32
|
+
alt={getAltText(item?.image_object, item.title)}
|
|
33
33
|
width={width}
|
|
34
34
|
height={height}
|
|
35
35
|
loading={disableLazyLoad ? 'eager' : 'lazy'}
|
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { Context } from '~context/TranslationsProvider';
|
|
3
4
|
import { getRating } from '~helpers/rating';
|
|
5
|
+
import { translate } from '~helpers/getters';
|
|
4
6
|
|
|
5
7
|
import styles from './one-star.module.scss';
|
|
6
8
|
|
|
7
|
-
const OneStar = ({ numOfStars, rating, active = true }) =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const OneStar = ({ numOfStars, rating, active = true, showLabel = false }) => {
|
|
10
|
+
const { translations } = useContext(Context) || {};
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div className={`${styles.starRatingContainer} ${!active && styles.inactive}`}>
|
|
14
|
+
{showLabel && (
|
|
15
|
+
<span className={styles.text}>{translate(translations, 'rating', 'Rating')}</span>
|
|
16
|
+
)}
|
|
17
|
+
<span className={styles.fullStar} />
|
|
18
|
+
<span className={styles.text}>{`${getRating(rating)}/${numOfStars}`}</span>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
13
22
|
|
|
14
23
|
OneStar.propTypes = {
|
|
15
24
|
numOfStars: PropTypes.oneOf([5, 10]).isRequired,
|
|
16
25
|
rating: PropTypes.oneOfType([PropTypes.array, PropTypes.number, PropTypes.string]).isRequired,
|
|
17
26
|
active: PropTypes.bool,
|
|
27
|
+
showLabel: PropTypes.bool,
|
|
18
28
|
};
|
|
19
29
|
|
|
20
30
|
export default OneStar;
|
|
@@ -7,22 +7,23 @@
|
|
|
7
7
|
line-height: 2.1rem;
|
|
8
8
|
border-radius: 0.4rem;
|
|
9
9
|
border: 1px solid var(--main-star-wrapper-color);
|
|
10
|
-
|
|
11
|
-
.fullStar {
|
|
12
|
-
@include star(var(--full-star-fill-color), var(--full-star-border-color), unset, 2.1rem);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.rateNr {
|
|
16
|
-
color: #17182f;
|
|
17
|
-
font-weight: 700;
|
|
18
|
-
font-size: 1.3rem;
|
|
19
|
-
margin-left: 0.33rem;
|
|
20
|
-
line-height: 2.1rem;
|
|
21
|
-
}
|
|
22
|
-
|
|
10
|
+
|
|
23
11
|
&.inactive {
|
|
24
12
|
.fullStar {
|
|
25
13
|
@include star(var(--empty-star-border-color), var(--empty-star-border-color), unset, 2.1rem);
|
|
26
14
|
}
|
|
27
15
|
}
|
|
28
16
|
}
|
|
17
|
+
|
|
18
|
+
.fullStar {
|
|
19
|
+
@include star(var(--full-star-fill-color), var(--full-star-border-color), unset, 2.1rem);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.text {
|
|
23
|
+
color: #17182f;
|
|
24
|
+
font-weight: 700;
|
|
25
|
+
font-size: 1.3rem;
|
|
26
|
+
margin: 0 0.33rem;
|
|
27
|
+
line-height: 2.1rem;
|
|
28
|
+
}
|
|
29
|
+
|
|
@@ -4,10 +4,10 @@ import { MdCheck } from 'react-icons/md';
|
|
|
4
4
|
import Bonus from '~atoms/bonus';
|
|
5
5
|
import { Context } from '~context/TranslationsProvider';
|
|
6
6
|
import SellingPoints from '~atoms/selling-points';
|
|
7
|
-
import StarRating from '~molecules/star-rating';
|
|
7
|
+
import StarRating from '~molecules/star-rating/one-star';
|
|
8
8
|
import Link from '~hooks/link';
|
|
9
9
|
import OperatorCta from '~atoms/operator-cta';
|
|
10
|
-
import { prettyTracker, imagePrettyUrl, translate } from '~helpers/getters';
|
|
10
|
+
import { prettyTracker, imagePrettyUrl, translate, getAltText } from '~helpers/getters';
|
|
11
11
|
import LazyImage from '~hooks/lazy-image';
|
|
12
12
|
|
|
13
13
|
import styles from './default-row.module.scss';
|
|
@@ -17,6 +17,8 @@ const Row = ({ item, oneliner = 'main', layout = 'list', tracker = 'main' }) =>
|
|
|
17
17
|
const itemRating = item.rating;
|
|
18
18
|
const { translations } = useContext(Context) || {};
|
|
19
19
|
|
|
20
|
+
const imageObject = item?.standardised_logo_url_object || item?.logo_url_object;
|
|
21
|
+
|
|
20
22
|
return (
|
|
21
23
|
<div className={`${styles.row} ${styles[layout]}`}>
|
|
22
24
|
<a
|
|
@@ -37,10 +39,10 @@ const Row = ({ item, oneliner = 'main', layout = 'list', tracker = 'main' }) =>
|
|
|
37
39
|
aria-label={`${item.name} Link`}
|
|
38
40
|
>
|
|
39
41
|
<LazyImage
|
|
40
|
-
alt={item.name}
|
|
41
|
-
src={imagePrettyUrl(item
|
|
42
|
-
width={
|
|
43
|
-
height={
|
|
42
|
+
alt={getAltText(imageObject, item.name)}
|
|
43
|
+
src={imagePrettyUrl(imageObject?.filename || item?.logo_url, 100)}
|
|
44
|
+
width={100}
|
|
45
|
+
height={100}
|
|
44
46
|
/>
|
|
45
47
|
</a>
|
|
46
48
|
<a
|
|
@@ -51,7 +53,7 @@ const Row = ({ item, oneliner = 'main', layout = 'list', tracker = 'main' }) =>
|
|
|
51
53
|
>
|
|
52
54
|
<Bonus item={item} tracker={oneliner} />
|
|
53
55
|
</a>
|
|
54
|
-
<StarRating numOfStars={5} rating={itemRating} />
|
|
56
|
+
<StarRating numOfStars={5} rating={itemRating} showLabel />
|
|
55
57
|
<SellingPoints icon={<MdCheck />} sellingPoints={item.selling_points} />
|
|
56
58
|
<div>
|
|
57
59
|
<Link className={`${styles.reviewLink} toplist-variant-one-gtm`} to={item.review_link}>
|
|
@@ -80,6 +82,12 @@ Row.propTypes = {
|
|
|
80
82
|
one_liner: PropTypes.string,
|
|
81
83
|
}),
|
|
82
84
|
}),
|
|
85
|
+
logo_url_object: PropTypes.shape({
|
|
86
|
+
filename: PropTypes.string,
|
|
87
|
+
}),
|
|
88
|
+
standardised_logo_url_object: PropTypes.shape({
|
|
89
|
+
filename: PropTypes.string,
|
|
90
|
+
}),
|
|
83
91
|
bonus: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
|
84
92
|
}).isRequired,
|
|
85
93
|
};
|
|
@@ -49,10 +49,7 @@ const Head = ({ page = {}, siteInfo }) => {
|
|
|
49
49
|
<meta name="robots" content={page.meta_robots.join()} />
|
|
50
50
|
)}
|
|
51
51
|
|
|
52
|
-
{page.robot_options &&
|
|
53
|
-
<meta name="robots" content={getRobotOptions(page.robot_options)} />
|
|
54
|
-
)}
|
|
55
|
-
{page.path.includes('/page/') && <meta name="robots" content="noindex,follow" />}
|
|
52
|
+
{page.robot_options && <meta name="robots" content={getRobotOptions(page.robot_options)} />}
|
|
56
53
|
|
|
57
54
|
{process.env.GATSBY_ACTIVE_ENV === 'development' && (
|
|
58
55
|
<meta name="googlebot" content="noindex,follow" />
|
|
@@ -12,6 +12,8 @@ export const pickPageKeys = [
|
|
|
12
12
|
];
|
|
13
13
|
|
|
14
14
|
export const topListPickKeys = [
|
|
15
|
+
'standardised_logo_url_object',
|
|
16
|
+
'logo_url_object',
|
|
15
17
|
'logo_url',
|
|
16
18
|
'one_liner',
|
|
17
19
|
'one_liners',
|
|
@@ -35,6 +37,8 @@ export const topListPickKeys = [
|
|
|
35
37
|
export const pickRelationKeys = {
|
|
36
38
|
tournament: ['tournaments'],
|
|
37
39
|
operator: [
|
|
40
|
+
'standardised_logo_url_object',
|
|
41
|
+
'logo_url_object',
|
|
38
42
|
'logo_url',
|
|
39
43
|
'one_liner',
|
|
40
44
|
'one_liners',
|
|
@@ -60,9 +64,10 @@ export const pickRelationKeys = {
|
|
|
60
64
|
'third_rating',
|
|
61
65
|
'fourth_rating',
|
|
62
66
|
'thumbnail_filename',
|
|
67
|
+
'thumbnail_filename_object',
|
|
63
68
|
],
|
|
64
|
-
software_provider: ['logo', 'games_count', 'name'],
|
|
65
|
-
payment_method: ['logo', 'name'],
|
|
69
|
+
software_provider: ['logo_object', 'logo', 'games_count', 'name'],
|
|
70
|
+
payment_method: ['logo_object', 'logo', 'name'],
|
|
66
71
|
};
|
|
67
72
|
|
|
68
73
|
export const pickHTMLSitemapPageKeys = ['title', 'path', 'template_id'];
|
package/src/helpers/getters.js
CHANGED
|
@@ -368,3 +368,7 @@ export const getRoundMinutes = (time) => {
|
|
|
368
368
|
const value = seconds > 30 ? Number(minutes) + 1 : Number(minutes);
|
|
369
369
|
return value === 0 ? 1 : value;
|
|
370
370
|
};
|
|
371
|
+
|
|
372
|
+
export function getAltText(imageObject, defaultAlt = 'missing alt') {
|
|
373
|
+
return imageObject && imageObject.alt ? imageObject.alt : defaultAlt;
|
|
374
|
+
}
|
|
@@ -245,10 +245,12 @@ describe('Getters Helper', () => {
|
|
|
245
245
|
Getters.shiftFirstOperator(11607, module, pagesMappedById);
|
|
246
246
|
expect(module.items[0].id).toBe(11607);
|
|
247
247
|
});
|
|
248
|
+
|
|
248
249
|
test('move opeartor first postion', () => {
|
|
249
250
|
Getters.shiftFirstOperator(13212, module, pagesMappedById);
|
|
250
251
|
expect(module.items[0].id).toBe(13212);
|
|
251
252
|
});
|
|
253
|
+
|
|
252
254
|
test('check when we have the operator in first postion', () => {
|
|
253
255
|
Getters.shiftFirstOperator(13212, module, pagesMappedById);
|
|
254
256
|
expect(module.items[0].id).toBe(13212);
|
|
@@ -257,7 +259,18 @@ describe('Getters Helper', () => {
|
|
|
257
259
|
test('If the reading time is bigger than half, it should return the next number ', () => {
|
|
258
260
|
expect(Getters.getRoundMinutes('3:52')).toBe(4);
|
|
259
261
|
});
|
|
262
|
+
|
|
260
263
|
test('If reading time is less than half, it should return the last number ', () => {
|
|
261
264
|
expect(Getters.getRoundMinutes('3:29')).toBe(3);
|
|
262
265
|
});
|
|
266
|
+
|
|
267
|
+
test('Test altText', () => {
|
|
268
|
+
const alt = Getters.getAltText({ alt: 'imageAlt' }, 'default');
|
|
269
|
+
expect(alt).toEqual('imageAlt');
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
test('Test without altText', () => {
|
|
273
|
+
const altText = Getters.getAltText(null, 'default');
|
|
274
|
+
expect(altText).toEqual('default');
|
|
275
|
+
});
|
|
263
276
|
});
|