gatsby-core-theme 13.0.1-beta.2 → 13.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 +17 -9
- package/babel.config.js +7 -6
- package/package.json +1 -1
- package/src/components/molecules/search/index.js +2 -1
- package/src/components/molecules/toplist/default-row/default-row.module.scss +14 -0
- package/src/components/molecules/toplist/default-row/index.js +4 -0
- package/src/components/organisms/toplist/index.js +22 -18
- package/src/components/organisms/toplist/toplist.module.scss +3 -1
- package/src/components/organisms/toplist/toplist.test.js +3 -5
- package/src/constants/pick-keys.js +2 -0
- package/src/helpers/processor/index.js +14 -0
- package/src/helpers/processor/modules.js +3 -0
- package/src/hooks/tabs/index.js +14 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
|
-
## [13.0.1
|
|
1
|
+
## [13.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v13.0.0...v13.0.1) (2022-10-24)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
+
* add logic for ribbons ([95dfbd7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/95dfbd77ea4a42c1a8d82d1a8ecdf495a42625e3))
|
|
7
|
+
* added babel react preset ([f3a9c5b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f3a9c5bd84ee651a2e759a4da2459b5db69b57e3))
|
|
8
|
+
* added gatsby head instead of react helmet ([a5a6acc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a5a6acc7b9e494afbc11fa2caf496ffa2bc695af))
|
|
9
|
+
* added ribbons in default row ([d93f0d9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d93f0d9078568ab2173b5e4cd4446137a324ba9f))
|
|
10
|
+
* if ribbons are empty in toplist check to get data in the operator ([e32b044](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e32b0449364695be9a0a7b4e411462242fd90836))
|
|
11
|
+
* if the ribbon is empty for toplist and oprator check the extra fields ([5d05607](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5d0560760ea6848b175c22e85ea60d938834aba0))
|
|
6
12
|
* removed unused packages from package json ([7b4daa2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7b4daa21cd8318eb43a991bcf36d6f012e43d1f6))
|
|
13
|
+
* ribbons logic ([a9c0500](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a9c05006f5f818a9847da6b6e94672b586595109))
|
|
14
|
+
* validate data ([f111dda](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f111ddaaee78ca89040997966a91b71d8fbcc05f))
|
|
7
15
|
|
|
8
16
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## [13.0.1-beta.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v13.0.0...v13.0.1-beta.1) (2022-10-17)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
### Bug Fixes
|
|
17
|
+
### Code Refactoring
|
|
15
18
|
|
|
16
|
-
*
|
|
19
|
+
* update tabs forceCheck loading ([9b18a03](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9b18a032319ccbf971f404a2ed62ae4cbfebca1f))
|
|
20
|
+
* update tabs loading in search and toplist tests ([4430a09](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4430a0984f9fd1c63e0fc2f5f5e5b8ec5034bd99))
|
|
21
|
+
* update toplist component ([4dcede5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4dcede535cfd8a50f020d7fdf351fab6ab7d13b3))
|
|
22
|
+
* update toplist component code splitting ([b36b57b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b36b57b6b3e974dfb180d0170146825b38fa9761))
|
|
17
23
|
|
|
18
24
|
|
|
19
|
-
* Merge branch 'tm-
|
|
25
|
+
* Merge branch 'tm-3051-ribbons' into 'master' ([4512811](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/45128114e4d1518bc6edf710d538678c24c68fc0))
|
|
26
|
+
* Merge branch 'tm-3076-head-api' into 'master' ([a0cbf8b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a0cbf8bf960a8a2a7b096a4a5526d5bee5dfc2fc))
|
|
27
|
+
* Merge branch 'tm-3076-pagespeed-improvements-toplist-tabs' into 'master' ([3df702f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3df702f34a7aec7e7a4f8f561ce8fd2cb7289425))
|
|
20
28
|
|
|
21
29
|
# [13.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v12.0.4...v13.0.0) (2022-10-17)
|
|
22
30
|
|
package/babel.config.js
CHANGED
package/package.json
CHANGED
|
@@ -6,7 +6,6 @@ import loadable from '@loadable/component';
|
|
|
6
6
|
import LazyImage from '~hooks/lazy-image';
|
|
7
7
|
import ConditionalWrapper from '~atoms/conditional-wrapper';
|
|
8
8
|
import styles from './search.module.scss';
|
|
9
|
-
import Tabs from '~hooks/tabs';
|
|
10
9
|
import { getURLParam } from '~helpers/getters';
|
|
11
10
|
import keygen from '~helpers/keygen';
|
|
12
11
|
import { filterByKey, sortDateOn, sortIntOn, sortStringOn } from '~helpers/search';
|
|
@@ -248,6 +247,8 @@ const Search = ({
|
|
|
248
247
|
);
|
|
249
248
|
}
|
|
250
249
|
|
|
250
|
+
const Tabs = searchResultsRef.current.length !== 0 && loadable(() => import('~hooks/tabs'));
|
|
251
|
+
|
|
251
252
|
return (
|
|
252
253
|
<>
|
|
253
254
|
{formSearchOptionsCopy !== null && (
|
|
@@ -45,3 +45,17 @@
|
|
|
45
45
|
@include flex-align(center, center);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
+
|
|
49
|
+
.ribbons {
|
|
50
|
+
position: absolute;
|
|
51
|
+
top: -1rem;
|
|
52
|
+
@include flex-direction(row);
|
|
53
|
+
gap: 1rem;
|
|
54
|
+
|
|
55
|
+
> span {
|
|
56
|
+
color: white;
|
|
57
|
+
padding: .2rem 1rem;
|
|
58
|
+
background-color: red;
|
|
59
|
+
border-radius: 1rem;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -20,6 +20,9 @@ const Row = ({ item, oneliner = 'main', layout = 'list', tracker = 'main' }) =>
|
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
22
|
<div className={`${styles.row} ${styles[layout]}`}>
|
|
23
|
+
<div className={styles.ribbons}>
|
|
24
|
+
{item.ribbons && item.ribbons.map((ribbon) => <span>{ribbon}</span>)}
|
|
25
|
+
</div>
|
|
23
26
|
<a
|
|
24
27
|
href={prettyLink}
|
|
25
28
|
className="casinos-top-list-gtm name-cta"
|
|
@@ -72,6 +75,7 @@ Row.propTypes = {
|
|
|
72
75
|
tracker: PropTypes.string,
|
|
73
76
|
item: PropTypes.shape({
|
|
74
77
|
name: PropTypes.string,
|
|
78
|
+
ribbons: PropTypes.arrayOf(PropTypes.string),
|
|
75
79
|
logo_url: PropTypes.string,
|
|
76
80
|
selling_points: PropTypes.arrayOf(PropTypes.string),
|
|
77
81
|
review_link: PropTypes.string,
|
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import loadable from '@loadable/component';
|
|
3
4
|
import keygen from '~helpers/keygen';
|
|
4
5
|
import List from './list';
|
|
5
|
-
import
|
|
6
|
+
import styles from './toplist.module.scss';
|
|
6
7
|
|
|
7
8
|
const TopList = ({ module, toplistHeading, CustomRow, page }) => {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
<
|
|
11
|
-
{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
9
|
+
const showTabs = module.items.length > 1;
|
|
10
|
+
const content = module.items.map((toplist) => (
|
|
11
|
+
<div className={!showTabs && styles.toplistContainer} label={toplist.title} key={keygen()}>
|
|
12
|
+
{toplistHeading}
|
|
13
|
+
<List
|
|
14
|
+
toplist={toplist}
|
|
15
|
+
CustomRow={CustomRow}
|
|
16
|
+
hasLoadMoreButton={toplist.show_load_more}
|
|
17
|
+
initItemsCount={toplist.num_items_initial_load}
|
|
18
|
+
loadItemsCount={toplist.num_items_load_more}
|
|
19
|
+
pageTemplate={page?.template}
|
|
20
|
+
/>
|
|
21
|
+
</div>
|
|
22
|
+
));
|
|
23
|
+
const Tabs = showTabs && loadable(() => import('~hooks/tabs'));
|
|
24
|
+
|
|
25
|
+
return showTabs ? (
|
|
26
|
+
<Tabs tabsAlign="right" gtmClass="toplist-tabs-menu-gtm" children={content} />
|
|
27
|
+
) : (
|
|
28
|
+
content
|
|
25
29
|
);
|
|
26
30
|
};
|
|
27
31
|
|
|
@@ -9,21 +9,19 @@ import { getListToplistItems } from '~tests/factories/modules/toplist.factory';
|
|
|
9
9
|
|
|
10
10
|
describe('Organisms/TopList', () => {
|
|
11
11
|
test('render with props', () => {
|
|
12
|
-
const { container } = render(<TopList module={{ items: getListToplistItems(
|
|
12
|
+
const { container } = render(<TopList module={{ items: getListToplistItems(1) }} />);
|
|
13
13
|
expect(container).toBeTruthy();
|
|
14
14
|
expect(container.querySelector('.list')).toBeTruthy();
|
|
15
15
|
});
|
|
16
|
-
|
|
17
16
|
test('headerExtra', () => {
|
|
18
17
|
const { container } = render(
|
|
19
18
|
<TopList
|
|
20
|
-
module={{ items: getListToplistItems(
|
|
19
|
+
module={{ items: getListToplistItems(1) }}
|
|
21
20
|
toplistHeading={<div className="my-header" />}
|
|
22
21
|
/>
|
|
23
22
|
);
|
|
24
23
|
expect(container.querySelector('.my-header')).toBeTruthy();
|
|
25
24
|
});
|
|
26
|
-
|
|
27
25
|
test('CustomRow', () => {
|
|
28
26
|
const Row = ({ item, tracker }) => (
|
|
29
27
|
<div className="my-row">
|
|
@@ -32,7 +30,7 @@ describe('Organisms/TopList', () => {
|
|
|
32
30
|
</div>
|
|
33
31
|
);
|
|
34
32
|
const { container } = render(
|
|
35
|
-
<TopList module={{ items: getListToplistItems(
|
|
33
|
+
<TopList module={{ items: getListToplistItems(1) }} CustomRow={Row} />
|
|
36
34
|
);
|
|
37
35
|
expect(container.querySelector('.my-row')).toBeTruthy();
|
|
38
36
|
});
|
|
@@ -32,6 +32,7 @@ export const topListPickKeys = [
|
|
|
32
32
|
'short_name',
|
|
33
33
|
'status',
|
|
34
34
|
'founded',
|
|
35
|
+
'ribbons',
|
|
35
36
|
];
|
|
36
37
|
|
|
37
38
|
export const pickRelationKeys = {
|
|
@@ -56,6 +57,7 @@ export const pickRelationKeys = {
|
|
|
56
57
|
'links',
|
|
57
58
|
'extra_fields',
|
|
58
59
|
'status',
|
|
60
|
+
'ribbons',
|
|
59
61
|
],
|
|
60
62
|
game: [
|
|
61
63
|
'game_provider',
|
|
@@ -261,6 +261,20 @@ export default {
|
|
|
261
261
|
transformedPages[market][pageType][index].relation =
|
|
262
262
|
relations[page.type][page.relation_id] || null;
|
|
263
263
|
|
|
264
|
+
if (page.type === 'operator') {
|
|
265
|
+
// eslint-disable-next-line camelcase, prefer-const
|
|
266
|
+
const { ribbons, extra_fields } = page.relation;
|
|
267
|
+
|
|
268
|
+
// eslint-disable-next-line no-unused-expressions
|
|
269
|
+
ribbons.length > 0 &&
|
|
270
|
+
ribbons.forEach((res, index) => {
|
|
271
|
+
ribbons[index] = data.ribbons[res] ? data.ribbons[res].label : res;
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
if (ribbons.length === 0 && extra_fields.ribbon_text) {
|
|
275
|
+
page.relation.ribbons = extra_fields.ribbon_text.split(',');
|
|
276
|
+
}
|
|
277
|
+
}
|
|
264
278
|
// Linking game provider path to the game
|
|
265
279
|
if (page.type === 'game') {
|
|
266
280
|
const providerId =
|
|
@@ -248,6 +248,9 @@ export function processArchiveModule(module, pages) {
|
|
|
248
248
|
export function processTopListModule(module, relations, pages) {
|
|
249
249
|
module.items = module.items.map((listItem) => {
|
|
250
250
|
listItem.items = listItem.items.map((item) => {
|
|
251
|
+
// Remove the ribbons if are empty, will be add ribbons from operator
|
|
252
|
+
if (item.ribbons && item.ribbons.length === 0) delete item.ribbons;
|
|
253
|
+
|
|
251
254
|
const clone = pick(cloneDeep(relations.operator[item.operator_id]), topListPickKeys);
|
|
252
255
|
const operatorPage =
|
|
253
256
|
pages && pages.operator
|
package/src/hooks/tabs/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { forceCheck } from 'react-lazyload';
|
|
4
3
|
import loadable from '@loadable/component';
|
|
5
4
|
import styles from './tabs.module.scss';
|
|
6
5
|
|
|
@@ -14,28 +13,25 @@ const Tabs = ({
|
|
|
14
13
|
gtmClass = '',
|
|
15
14
|
}) => {
|
|
16
15
|
const showAllTabId = `${showAll}_0`;
|
|
17
|
-
const showTabs = children.length > 1;
|
|
18
16
|
const [activeTab, setActiveTab] = useState(
|
|
19
17
|
showAll ? showAllTabId : `${children[0].props.label}_0`
|
|
20
18
|
);
|
|
21
|
-
|
|
22
|
-
const TabList = showTabs
|
|
23
|
-
|
|
19
|
+
const showTabs = children.length > 1;
|
|
20
|
+
const TabList = showTabs && loadable(() => import('./tab/tab-list'));
|
|
21
|
+
const { forceCheck } = TabList && loadable(() => import('react-lazyload'));
|
|
24
22
|
const tabHeaderClass = `${styles.tabsHeader} ${!HeaderComp && styles.tabsOnly} ${
|
|
25
23
|
styles[headerClass]
|
|
26
24
|
} ${tabsAlign === 'right' && styles.invertOrder}`;
|
|
27
25
|
|
|
28
|
-
function onClickTabItem(tabId) {
|
|
29
|
-
setActiveTab(tabId);
|
|
30
|
-
setTimeout(forceCheck);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
26
|
return (
|
|
34
27
|
<>
|
|
35
28
|
<div className={tabHeaderClass}>
|
|
36
29
|
{TabList && (
|
|
37
30
|
<TabList
|
|
38
|
-
onClick={
|
|
31
|
+
onClick={(tabId) => {
|
|
32
|
+
setActiveTab(tabId);
|
|
33
|
+
setTimeout(forceCheck);
|
|
34
|
+
}}
|
|
39
35
|
items={children}
|
|
40
36
|
activeTab={activeTab}
|
|
41
37
|
activeTabClass={activeTabClass}
|
|
@@ -46,17 +42,14 @@ const Tabs = ({
|
|
|
46
42
|
)}
|
|
47
43
|
{HeaderComp && <div className={styles.headerComp}>{HeaderComp}</div>}
|
|
48
44
|
</div>
|
|
49
|
-
|
|
50
45
|
<div className="tab-content">
|
|
51
|
-
{children.map(
|
|
52
|
-
|
|
53
|
-
child
|
|
54
|
-
(`${child.props.label}_${showAll ? index + 1 : index}`
|
|
55
|
-
activeTab
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return child.props.children;
|
|
59
|
-
})}
|
|
46
|
+
{children.map(
|
|
47
|
+
(child, index) =>
|
|
48
|
+
child !== null &&
|
|
49
|
+
(`${child.props.label}_${showAll ? index + 1 : index}` === activeTab ||
|
|
50
|
+
activeTab === showAllTabId) &&
|
|
51
|
+
child.props.children
|
|
52
|
+
)}
|
|
60
53
|
</div>
|
|
61
54
|
</>
|
|
62
55
|
);
|