gatsby-core-theme 6.0.1 → 6.1.2
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 +63 -0
- package/package.json +1 -1
- package/src/components/atoms/menu/items/item/index.js +1 -1
- package/src/components/atoms/menu/items/item/item.module.scss +28 -19
- package/src/components/atoms/menu/items/items.module.scss +1 -1
- package/src/components/molecules/operator-banner/index.js +3 -3
- package/src/components/molecules/operator-banner/operator-banner.module.scss +1 -1
- package/src/components/molecules/star-rating/one-star.js +20 -0
- package/src/components/molecules/star-rating/one-star.module.scss +26 -0
- package/src/components/molecules/star-rating/one-star.test.js +18 -0
- package/src/components/molecules/star-rating/star-rating.module.scss +1 -1
- package/src/constants/settings.js +5 -0
- package/src/helpers/getters.js +22 -0
- package/src/helpers/processor/index.js +3 -5
- package/src/helpers/processor/modules.js +16 -6
- package/src/helpers/processor/modules.test.js +19 -0
- package/src/hooks/lazy-image/index.js +11 -4
- package/src/styles/utils/_mixins.scss +4 -5
- package/src/styles/utils/variables/_main.scss +1 -0
- package/tests/factories/modules/card.factory.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,66 @@
|
|
|
1
|
+
## [6.1.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.1...v6.1.2) (2022-04-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add star ratings changes ([a7145f4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a7145f4ee6c6e8c73c879e3ea968ef1b5b3566f9))
|
|
7
|
+
* replace h3 with p for heading sequence ([046fd25](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/046fd25173b6293285687c0da4545eb687cfe726))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Code Refactoring
|
|
11
|
+
|
|
12
|
+
* seperate one star component ([77e38fc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/77e38fc9dfb1ec1b8be2a62bfbbad695ba9c46ca))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
* Merge branch 'tm-2813-heading-sequence' into 'master' ([1536f72](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1536f723f30ec5b794222db41fffcd398b3e0688))
|
|
16
|
+
* Merge branch 'fix-star-ratings' into 'master' ([954ff3a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/954ff3ace386c2165421731ad280e6d8ecd60c94))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Tests
|
|
20
|
+
|
|
21
|
+
* added test for onestar ([0f21ec6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0f21ec6ae1ae0133450ba1d15c442469c4abf18d))
|
|
22
|
+
|
|
23
|
+
## [6.1.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.0...v6.1.1) (2022-04-06)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Code Refactoring
|
|
27
|
+
|
|
28
|
+
* replace deprecated with calc in style ([411f685](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/411f685825d020414f76550399ddfeba47903073))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
* Merge branch 'tm-2812-fix-sasserrors' into 'master' ([7254b1e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7254b1e75029a73ebc2daa76df9e4afefb857428))
|
|
32
|
+
|
|
33
|
+
# [6.1.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.0.1...v6.1.0) (2022-04-06)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* make style ([3f83da5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3f83da5fd9160bd5e476d58a7bb378b9fcb42b98))
|
|
39
|
+
* make style for submenus ([e4a8b91](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e4a8b919ceff29d866d2ea23d673d633d6373e82))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Code Refactoring
|
|
43
|
+
|
|
44
|
+
* remove unnecessary id from generateArrayRandom ([8cf09e2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8cf09e2b0d9cd9c6b638c1ec8c53886f95121e6e))
|
|
45
|
+
* update cards random sorting filter ([382222e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/382222eb67070b8e9dee33ef37d75eef198a881c))
|
|
46
|
+
* update update cards random sorting filter with lodash ([a6b2093](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a6b209301b9a3493adce986edad6c8c6a10ccc6b))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
* Merge branch 'tm-2806-webp-images' into 'master' ([41269ae](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/41269aea2b48f5cf5d8b1bac2fa1b3d5b5f498f6))
|
|
50
|
+
* Merge branch 'tm-2805-cards-random-filter' into 'master' ([9c14230](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9c1423082cf453b4af943181c567429631d08f37))
|
|
51
|
+
* Merge branch 'tm-2840-menu-issue' into 'master' ([efb78f3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/efb78f3b00cf3a5b327c8d9d2c0005a1ad73ccac))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Features
|
|
55
|
+
|
|
56
|
+
* added webp logic in lazy image component ([6cb2453](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6cb2453b60ad8355b1c39519e3c3fce732678a90))
|
|
57
|
+
* added webp logic in lazy image component ([c70a893](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c70a893976aef767aaa7de2e7f3eb7907be48ce5))
|
|
58
|
+
* added webp logic in lazy image component ([4fa73b5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4fa73b5ad5c65697f408bca4bb87bf8aae7a15d2))
|
|
59
|
+
* added webp logic in lazy image component ([2cb84aa](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2cb84aa43f008a769292539a41102df8bb69174c))
|
|
60
|
+
* added webp logic in lazy image component ([6c4bec0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6c4bec0e6421ff982bf4bdf94fc6249dd5d11d02))
|
|
61
|
+
* added webp logic in lazy image component ([afa63c8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/afa63c8122cbbe62f90486c5fffd65255d6ad03f))
|
|
62
|
+
* added webp logic in lazy image component ([d58e62d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d58e62d0912788d32ece115fe954e000bf172d6b))
|
|
63
|
+
|
|
1
64
|
## [6.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.0.0...v6.0.1) (2022-04-04)
|
|
2
65
|
|
|
3
66
|
|
package/package.json
CHANGED
|
@@ -101,7 +101,7 @@ export default function Item({
|
|
|
101
101
|
) : (
|
|
102
102
|
<div className={styles.item}>{item.title}</div>
|
|
103
103
|
)}
|
|
104
|
-
{options.mobile.subMenuDropDownButton &&
|
|
104
|
+
{options.mobile.subMenuDropDownButton && hasChildren && (
|
|
105
105
|
<button
|
|
106
106
|
aria-label={`${item?.title} Dropdown`}
|
|
107
107
|
type="button"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
.itemWrapper
|
|
1
|
+
.itemWrapper {
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: space-between;
|
|
4
4
|
|
|
5
5
|
.item {
|
|
6
|
-
width:
|
|
6
|
+
width: 100%;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -33,23 +33,32 @@
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
.itemWrapper {
|
|
37
|
+
@include max(laptop) {
|
|
38
|
+
button {
|
|
39
|
+
width: 20%;
|
|
40
|
+
max-width: 75px;
|
|
41
|
+
position: relative;
|
|
42
|
+
background-color: var(--primary-hover-color);
|
|
43
|
+
|
|
44
|
+
&.active {
|
|
45
|
+
@include arrow-rotate(0);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&:after {
|
|
49
|
+
transition: 0.2s;
|
|
50
|
+
@include arrow(var(--nav-icon-color), 1rem, down, false);
|
|
51
|
+
|
|
52
|
+
position: absolute;
|
|
53
|
+
top: calc(50% - 0.4rem);
|
|
54
|
+
left: calc(50% - 1.2rem);
|
|
55
|
+
margin-left: 1rem;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
44
58
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
position: absolute;
|
|
51
|
-
top: calc(50% - 0.4rem);
|
|
52
|
-
left: calc(50% - 1.2rem);
|
|
53
|
-
margin-left: 1rem;
|
|
59
|
+
@include min(desktop) {
|
|
60
|
+
button {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
54
63
|
}
|
|
55
64
|
}
|
|
@@ -52,8 +52,8 @@ export default function OperatorBanner({
|
|
|
52
52
|
<LazyImage alt={operator?.name} src={imagePrettyUrl(logo)} />
|
|
53
53
|
</a>
|
|
54
54
|
) : (
|
|
55
|
-
<div>
|
|
56
|
-
<
|
|
55
|
+
<div className={styles.nameTitle}>
|
|
56
|
+
<p>
|
|
57
57
|
<a
|
|
58
58
|
href={prettyLink}
|
|
59
59
|
title={operator?.name}
|
|
@@ -63,7 +63,7 @@ export default function OperatorBanner({
|
|
|
63
63
|
>
|
|
64
64
|
{operator?.name}
|
|
65
65
|
</a>
|
|
66
|
-
</
|
|
66
|
+
</p>
|
|
67
67
|
{!isPlaceholder && hasStars && (
|
|
68
68
|
<StarRating numOfStars={5} rating={operator.rating} />
|
|
69
69
|
)}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { getRating } from '~helpers/rating';
|
|
4
|
+
|
|
5
|
+
import styles from './one-star.module.scss';
|
|
6
|
+
|
|
7
|
+
const OneStar = ({ numOfStars, rating, active = true }) => (
|
|
8
|
+
<div className={`${styles.starRatingContainer} ${!active && styles.inactive}`}>
|
|
9
|
+
<span className={styles.fullStar} />
|
|
10
|
+
<span className={styles.rateNr}>{`${getRating(rating)}/${numOfStars}`}</span>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
OneStar.propTypes = {
|
|
15
|
+
numOfStars: PropTypes.oneOf([5, 10]).isRequired,
|
|
16
|
+
rating: PropTypes.oneOfType([PropTypes.array, PropTypes.number, PropTypes.string]).isRequired,
|
|
17
|
+
active: PropTypes.bool,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default OneStar;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.starRatingContainer {
|
|
2
|
+
@include flex-direction(row);
|
|
3
|
+
@include flex-align(center, center);
|
|
4
|
+
background-color: #ffffff;
|
|
5
|
+
min-width: 6.5rem;
|
|
6
|
+
min-height: 2.1rem;
|
|
7
|
+
border-radius: 0.4rem;
|
|
8
|
+
border: 1px solid var(--main-star-wrapper-color);
|
|
9
|
+
|
|
10
|
+
.fullStar {
|
|
11
|
+
@include star(var(--full-star-fill-color), var(--full-star-border-color));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.rateNr {
|
|
15
|
+
color: #17182f;
|
|
16
|
+
font-weight: 700;
|
|
17
|
+
font-size: 1.3rem;
|
|
18
|
+
margin-left: 0.33rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&.inactive {
|
|
22
|
+
.fullStar {
|
|
23
|
+
@include star(var(--empty-star-border-color), var(--empty-star-border-color));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, cleanup } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
4
|
+
|
|
5
|
+
import OneStar from './one-star';
|
|
6
|
+
|
|
7
|
+
describe('OneStar Component', () => {
|
|
8
|
+
test('render container with correct rating', async () => {
|
|
9
|
+
const { container } = render(<OneStar numOfStars={5} rating={3} />);
|
|
10
|
+
|
|
11
|
+
expect(container.querySelectorAll('span')).toHaveLength(2);
|
|
12
|
+
expect(container.querySelectorAll('span')[1].innerHTML).toBe('3/5');
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
cleanup();
|
|
18
|
+
});
|
|
@@ -9,6 +9,11 @@ export default {
|
|
|
9
9
|
'norskespilleautomater.com': ['cards', 'cards_v2'],
|
|
10
10
|
'playcasino.co.za': ['cards', 'cards_v2'],
|
|
11
11
|
},
|
|
12
|
+
filter_cards_modules: {
|
|
13
|
+
'irishluck.ie': ['inactive', 'blacklisted'],
|
|
14
|
+
'norskespilleautomater.com': ['inactive', 'blacklisted'],
|
|
15
|
+
'playcasino.co.za': ['inactive', 'blacklisted'],
|
|
16
|
+
},
|
|
12
17
|
keep_page_extra_fields: {
|
|
13
18
|
operator: {
|
|
14
19
|
'norskespilleautomater.com': true, // needed for inoperative / placeholder fields
|
package/src/helpers/getters.js
CHANGED
|
@@ -103,6 +103,28 @@ export function getImageExtension(filename) {
|
|
|
103
103
|
return filename && filename.split('.').pop();
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
export function isBrowserWebpCompatable(feature, callback) {
|
|
107
|
+
const kTestImages = {
|
|
108
|
+
lossy: 'UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA',
|
|
109
|
+
lossless: 'UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==',
|
|
110
|
+
alpha:
|
|
111
|
+
'UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==',
|
|
112
|
+
animation:
|
|
113
|
+
'UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA',
|
|
114
|
+
};
|
|
115
|
+
const img = new Image();
|
|
116
|
+
// eslint-disable-next-line func-names
|
|
117
|
+
img.onload = function () {
|
|
118
|
+
const result = img.width > 0 && img.height > 0;
|
|
119
|
+
callback(feature, result);
|
|
120
|
+
};
|
|
121
|
+
// eslint-disable-next-line func-names
|
|
122
|
+
img.onerror = function () {
|
|
123
|
+
callback(feature, false);
|
|
124
|
+
};
|
|
125
|
+
img.src = `data:image/webp;base64,${kTestImages[feature]}`;
|
|
126
|
+
}
|
|
127
|
+
|
|
106
128
|
export function imagePrettyUrl(filename = 'image.png', width = null, height = null) {
|
|
107
129
|
const cdnURL =
|
|
108
130
|
(getImageExtension(filename) === 'gif'
|
|
@@ -77,6 +77,7 @@ export function transform(response) {
|
|
|
77
77
|
|
|
78
78
|
const savedModules = {};
|
|
79
79
|
export function processSections(sections, skipPost = false, page) {
|
|
80
|
+
const siteName = page && page.siteInfo && page.siteInfo.site_name;
|
|
80
81
|
let minutes = 0;
|
|
81
82
|
let seconds = 0;
|
|
82
83
|
|
|
@@ -89,10 +90,7 @@ export function processSections(sections, skipPost = false, page) {
|
|
|
89
90
|
}
|
|
90
91
|
if (sections[sectionKey] && sections[sectionKey].modules) {
|
|
91
92
|
sections[sectionKey].modules.forEach((module, key) => {
|
|
92
|
-
if (
|
|
93
|
-
shouldSavePrefilled(module, page && page.siteInfo && page.siteInfo.site_name) &&
|
|
94
|
-
savedModules[module.module_value_id]
|
|
95
|
-
) {
|
|
93
|
+
if (shouldSavePrefilled(module, siteName) && savedModules[module.module_value_id]) {
|
|
96
94
|
module = savedModules[module.module_value_id];
|
|
97
95
|
} else {
|
|
98
96
|
sections[sectionKey].modules[module[key]] = processModule(
|
|
@@ -105,7 +103,7 @@ export function processSections(sections, skipPost = false, page) {
|
|
|
105
103
|
previewMode
|
|
106
104
|
);
|
|
107
105
|
|
|
108
|
-
if (shouldSavePrefilled(module,
|
|
106
|
+
if (shouldSavePrefilled(module, siteName)) {
|
|
109
107
|
savedModules[module.module_value_id] = module;
|
|
110
108
|
}
|
|
111
109
|
}
|
|
@@ -16,9 +16,12 @@ export function processCardsModule(module, pages, pagesCloned, pagesMappedById)
|
|
|
16
16
|
|
|
17
17
|
if (displayInput === 'automatic' && pages[modelType]) {
|
|
18
18
|
const numOfItems =
|
|
19
|
-
Math.sign(module.num_of_items) === 0 ? pages[modelType].length : module.num_of_items;
|
|
19
|
+
Math.sign(module.num_of_items) === 0 ? pages[modelType].length : Number(module.num_of_items);
|
|
20
20
|
if (sortBy === 'random') {
|
|
21
|
-
|
|
21
|
+
const samplePages = pagesCloned[modelType].filter(
|
|
22
|
+
(page) => !settings.filter_cards_modules[process.env.GATSBY_SITE_NAME].includes(page.status)
|
|
23
|
+
);
|
|
24
|
+
module.items = sampleSize(samplePages, numOfItems);
|
|
22
25
|
} else {
|
|
23
26
|
module.items = pagesCloned[modelType].slice(0, numOfItems);
|
|
24
27
|
}
|
|
@@ -177,7 +180,11 @@ export function processCardsV2(module, pagesCloned, pagesMappedById) {
|
|
|
177
180
|
|
|
178
181
|
// Applying sorting
|
|
179
182
|
if (sortType === 'random') {
|
|
180
|
-
|
|
183
|
+
const samplePages = uniquePages.filter(
|
|
184
|
+
(page) =>
|
|
185
|
+
!settings.filter_cards_modules[process.env.GATSBY_SITE_NAME].includes(page.status)
|
|
186
|
+
);
|
|
187
|
+
module.items = sampleSize(samplePages, itemLimit);
|
|
181
188
|
} else if (sortType === 'latest') {
|
|
182
189
|
if (uniquePages.length > 0) {
|
|
183
190
|
uniquePages.sort((a, b) => (a.created_at > b.created_at ? -1 : 1));
|
|
@@ -216,9 +223,12 @@ export function processTopListModule(module, relations) {
|
|
|
216
223
|
}
|
|
217
224
|
|
|
218
225
|
export function shouldSavePrefilled(module = {}, siteName) {
|
|
219
|
-
return
|
|
220
|
-
|
|
221
|
-
|
|
226
|
+
return (
|
|
227
|
+
module.value_type === ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET &&
|
|
228
|
+
((settings.dynamic_prefilled_modules[siteName] &&
|
|
229
|
+
!settings.dynamic_prefilled_modules[siteName].includes(module.name)) ||
|
|
230
|
+
module.sort_by !== 'random')
|
|
231
|
+
);
|
|
222
232
|
}
|
|
223
233
|
|
|
224
234
|
export function processModule(
|
|
@@ -39,6 +39,25 @@ describe('Modules Helper', () => {
|
|
|
39
39
|
expect(moduleData.items).toHaveLength(4);
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
+
test('Cards V2 FIltered inactive', () => {
|
|
43
|
+
process.env.GATSBY_SITE_NAME = 'irishluck.ie';
|
|
44
|
+
const pagesNum = 10;
|
|
45
|
+
const moduleData = getSampleCardsV2Filtered(false, 'Game');
|
|
46
|
+
moduleData.cards_selector_filters_sort_by = 'random';
|
|
47
|
+
moduleData.cards_selector_filters_limit = '3';
|
|
48
|
+
const pageList = getPageDataList(pagesNum).map((page, i) =>
|
|
49
|
+
i % 2
|
|
50
|
+
? { ...page, type: 'game', status: 'inactive' }
|
|
51
|
+
: { ...page, type: 'game', status: 'active' }
|
|
52
|
+
);
|
|
53
|
+
processCardsV2(moduleData, groupBy(pageList, 'type'));
|
|
54
|
+
|
|
55
|
+
expect(moduleData.items).toHaveLength(3);
|
|
56
|
+
moduleData.items.forEach((item) => {
|
|
57
|
+
expect(item.id % 2).toEqual(0);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
42
61
|
test('filterPages function', () => {
|
|
43
62
|
const pages = getPageDataList(3);
|
|
44
63
|
pages[0].author_id = 1;
|
|
@@ -3,6 +3,7 @@ import React, { useState, useEffect } from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import LazyLoad from 'react-lazyload';
|
|
5
5
|
import { isNativeImageLazyLoadingSupported } from '~helpers/device-detect';
|
|
6
|
+
import { isBrowserWebpCompatable } from '~helpers/getters';
|
|
6
7
|
|
|
7
8
|
export default function LazyImage({
|
|
8
9
|
height,
|
|
@@ -16,10 +17,16 @@ export default function LazyImage({
|
|
|
16
17
|
}) {
|
|
17
18
|
const [errorImage, setErrorImage] = useState(false);
|
|
18
19
|
const [nonNativeLazyLoaded, setNonNativeLazyLoaded] = useState(false);
|
|
20
|
+
const [imageSrc, setImageSrc] = useState(src);
|
|
19
21
|
|
|
20
22
|
useEffect(() => {
|
|
21
23
|
setNonNativeLazyLoaded(!isNativeImageLazyLoadingSupported());
|
|
22
|
-
|
|
24
|
+
isBrowserWebpCompatable('lossy', (_feature, isSupported) => {
|
|
25
|
+
if (!isSupported && src) {
|
|
26
|
+
setImageSrc(src.replace('filters:format(webp)/', ''));
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}, [src]);
|
|
23
30
|
|
|
24
31
|
if ((defaultImg && !src) || errorImage === true) {
|
|
25
32
|
return defaultImg;
|
|
@@ -27,7 +34,7 @@ export default function LazyImage({
|
|
|
27
34
|
|
|
28
35
|
return !nonNativeLazyLoaded ? (
|
|
29
36
|
<img
|
|
30
|
-
src={
|
|
37
|
+
src={imageSrc}
|
|
31
38
|
loading={loading}
|
|
32
39
|
className={className}
|
|
33
40
|
height={height}
|
|
@@ -45,7 +52,7 @@ export default function LazyImage({
|
|
|
45
52
|
debounce={0}
|
|
46
53
|
>
|
|
47
54
|
<img
|
|
48
|
-
src={
|
|
55
|
+
src={imageSrc}
|
|
49
56
|
className={className}
|
|
50
57
|
height={height}
|
|
51
58
|
width={width}
|
|
@@ -55,7 +62,7 @@ export default function LazyImage({
|
|
|
55
62
|
</LazyLoad>
|
|
56
63
|
<noscript>
|
|
57
64
|
<img
|
|
58
|
-
src={
|
|
65
|
+
src={imageSrc}
|
|
59
66
|
className={className}
|
|
60
67
|
height={height}
|
|
61
68
|
width={width}
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
pointer-events: none;
|
|
66
66
|
border-color: rgba(0, 0, 0, 0);
|
|
67
67
|
border-top: $height solid $color;
|
|
68
|
-
border-right: $width/2 solid transparent;
|
|
69
|
-
border-left: $width/2 solid transparent;
|
|
70
|
-
margin-left:
|
|
68
|
+
border-right: calc($width / 2) solid transparent;
|
|
69
|
+
border-left: calc($width / 2) solid transparent;
|
|
70
|
+
margin-left: - calc($width / 2);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -103,8 +103,7 @@
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
@mixin half-star($border-color: #fba62f, $half-empty-color: #fba62f , $half-full-color: white) {
|
|
106
|
+
@mixin half-star($border-color: #fba62f, $half-empty-color: #fba62f, $half-full-color: white) {
|
|
108
107
|
line-height: 2rem;
|
|
109
108
|
width: 16px;
|
|
110
109
|
font-weight: normal;
|
|
@@ -326,12 +326,12 @@ export function getSampleCardsV2ModuleManual() {
|
|
|
326
326
|
return sampleOperatorCards;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
export function getSampleCardsV2Filtered(empty = false) {
|
|
329
|
+
export function getSampleCardsV2Filtered(empty = false, type = 'Operator') {
|
|
330
330
|
const sampleOperatorCards = {
|
|
331
|
-
cards_page_type:
|
|
331
|
+
cards_page_type: type.toLocaleLowerCase(),
|
|
332
332
|
cards_page_type_id: 5,
|
|
333
333
|
cards_selector: 'use_filters',
|
|
334
|
-
module_title:
|
|
334
|
+
module_title: `${type} Cards`,
|
|
335
335
|
link_label: 'View more',
|
|
336
336
|
link_value: '/sample',
|
|
337
337
|
cards_selector_filters_limit: '4',
|