gatsby-matrix-theme 2.0.2 → 2.1.0
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 +126 -0
- package/gatsby-config.js +36 -0
- package/package.json +2 -2
- package/src/components/atoms/cards/popup-card/index.js +59 -0
- package/src/components/atoms/cards/popup-card/popup-card.module.scss +88 -0
- package/src/components/atoms/cards/popup-card/popup-card.stories.js +61 -0
- package/src/components/molecules/faq/faq.module.scss +14 -10
- package/src/components/molecules/header/variants/article/index.js +3 -3
- package/src/components/molecules/header/variants/operator/index.js +3 -3
- package/src/components/molecules/info-grid/index.js +10 -10
- package/src/components/molecules/toplist/row/variant-one.js +1 -1
- package/src/components/molecules/toplist/row/variant-one.test.js +2 -6
- package/src/components/organisms/footer-navigation/footer-navigation.module.scss +7 -3
- package/src/components/organisms/footer-navigation/index.js +1 -1
- package/src/components/organisms/popup/index.js +117 -0
- package/src/components/organisms/popup/popup.module.scss +96 -0
- package/src/components/organisms/popup/popup.stories.js +61 -0
- package/src/components/organisms/popup/popup.test.js +33 -0
- package/src/components/organisms/toplist/{comparisonTable/comparisonTable.module.scss → comparison-table/comparison-table.module.scss} +0 -0
- package/src/components/organisms/toplist/{comparisonTable → comparison-table}/index.js +3 -3
- package/src/components/organisms/toplist/index.js +29 -34
- package/src/components/organisms/toplist/list/index.js +1 -5
- package/src/gatsby-core-theme/components/atoms/archive/items/index.js +2 -1
- package/src/{components → gatsby-core-theme/components}/atoms/bonus/bonus.test.js +0 -0
- package/src/{components → gatsby-core-theme/components}/atoms/bonus/index.js +0 -0
- package/src/gatsby-core-theme/components/atoms/module-title/index.js +119 -3
- package/src/{components → gatsby-core-theme/components}/atoms/spotlights/index.js +0 -0
- package/src/{components → gatsby-core-theme/components}/atoms/spotlights/spotlights.module.scss +0 -0
- package/src/gatsby-core-theme/components/molecules/content/index.js +22 -11
- package/src/gatsby-core-theme/components/molecules/footer/index.js +0 -1
- package/src/gatsby-core-theme/components/molecules/main/index.js +49 -5
- package/src/gatsby-core-theme/components/molecules/module/index.js +6 -7
- package/src/gatsby-core-theme/components/molecules/search/index.js +2 -1
- package/src/{components → gatsby-core-theme/components}/organisms/anchor/anchor.module.scss +0 -0
- package/src/{components → gatsby-core-theme/components}/organisms/anchor/index.js +0 -1
- package/src/{components → gatsby-core-theme/components}/organisms/cards/cards.stories.js +6 -6
- package/src/{components → gatsby-core-theme/components}/organisms/cards/index.js +16 -8
- package/src/gatsby-core-theme/components/organisms/carousel/index.js +2 -1
- package/src/gatsby-core-theme/components/pages/body/index.js +16 -6
- package/src/helpers/popup.js +26 -0
- package/src/helpers/sitemap.js +24 -0
- package/storybook/public/0.50c23d5b.iframe.bundle.js +1 -0
- package/storybook/public/{1.5aafa1c6.iframe.bundle.js → 1.eef04bc1.iframe.bundle.js} +1 -1
- package/storybook/public/10.454cae2f.iframe.bundle.js +1 -0
- package/storybook/public/{10.ff4158b6.iframe.bundle.js → 11.6ec11208.iframe.bundle.js} +1 -1
- package/storybook/public/5.5635a723.iframe.bundle.js +3 -0
- package/storybook/public/{5.4b77de4e.iframe.bundle.js.LICENSE.txt → 5.5635a723.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook/public/5.5635a723.iframe.bundle.js.map +1 -0
- package/storybook/public/6.a0f625e4.iframe.bundle.js +1 -0
- package/storybook/public/7.4b9a5033.iframe.bundle.js +1 -0
- package/storybook/public/8.4148b63e.iframe.bundle.js +3 -0
- package/storybook/public/{7.065bf31c.iframe.bundle.js.LICENSE.txt → 8.4148b63e.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook/public/8.4148b63e.iframe.bundle.js.map +1 -0
- package/storybook/public/{8.02dc3716.iframe.bundle.js → 9.08fee7fe.iframe.bundle.js} +1 -1
- package/storybook/public/iframe.html +1 -1
- package/storybook/public/main.38a6239c.iframe.bundle.js +1 -0
- package/storybook/public/runtime~main.d64660ee.iframe.bundle.js +1 -0
- package/storybook/public/vendors~main.aac219e4.iframe.bundle.js +7 -0
- package/storybook/public/{vendors~main.cec0edea.iframe.bundle.js.LICENSE.txt → vendors~main.aac219e4.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook/public/vendors~main.aac219e4.iframe.bundle.js.map +1 -0
- package/src/components/atoms/author-box/author-box.module.scss +0 -92
- package/src/components/atoms/author-box/author-box.stories.js +0 -72
- package/src/components/atoms/author-box/author-box.test.js +0 -36
- package/src/components/atoms/author-box/index.js +0 -94
- package/src/components/atoms/module-title/index.js +0 -125
- package/src/components/atoms/module-title/module-title.module.scss +0 -52
- package/src/components/molecules/content/content.module.scss +0 -201
- package/src/components/molecules/content/content.stories.js +0 -79
- package/src/components/molecules/content/index.js +0 -81
- package/src/components/molecules/main/index.js +0 -51
- package/src/components/organisms/carousel/carousel.module.scss +0 -3
- package/src/components/organisms/carousel/index.js +0 -76
- package/src/gatsby-core-theme/components/molecules/header/index.js +0 -54
- package/src/gatsby-core-theme/components/organisms/toplist/index.js +0 -16
- package/src/gatsby-core-theme/components/organisms/toplist/toplist.stories.js +0 -105
- package/storybook/public/0.fcd9bade.iframe.bundle.js +0 -1
- package/storybook/public/5.4b77de4e.iframe.bundle.js +0 -3
- package/storybook/public/5.4b77de4e.iframe.bundle.js.map +0 -1
- package/storybook/public/6.df73e654.iframe.bundle.js +0 -1
- package/storybook/public/7.065bf31c.iframe.bundle.js +0 -3
- package/storybook/public/7.065bf31c.iframe.bundle.js.map +0 -1
- package/storybook/public/9.5532a106.iframe.bundle.js +0 -1
- package/storybook/public/main.3fea8a61.iframe.bundle.js +0 -1
- package/storybook/public/runtime~main.46d88268.iframe.bundle.js +0 -1
- package/storybook/public/vendors~main.cec0edea.iframe.bundle.js +0 -7
- package/storybook/public/vendors~main.cec0edea.iframe.bundle.js.map +0 -1
- package/tests/factories/modules/matrix/author-box.factory.js +0 -19
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/* eslint-disable no-unused-expressions */
|
|
2
|
+
/* eslint-disable react/button-has-type */
|
|
3
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
4
|
+
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
5
|
+
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
6
|
+
/* eslint-disable react/no-danger */
|
|
7
|
+
import React, { useRef, useEffect, useState } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { MdClose } from 'react-icons/md';
|
|
10
|
+
import { translate } from 'gatsby-core-theme/src/helpers/getters';
|
|
11
|
+
|
|
12
|
+
import { setIdleTimeout } from '../../../helpers/popup';
|
|
13
|
+
import PopupCard from '../../atoms/cards/popup-card';
|
|
14
|
+
|
|
15
|
+
import styles from './popup.module.scss';
|
|
16
|
+
|
|
17
|
+
const Popup = ({ module, translations, isStorybook = false }) => {
|
|
18
|
+
const modal = useRef(null);
|
|
19
|
+
const [showModal, setShowModal] = useState(false);
|
|
20
|
+
const { items } = module.items[0];
|
|
21
|
+
const shownItems = items?.slice(0, 4) || [];
|
|
22
|
+
const { style } = module;
|
|
23
|
+
|
|
24
|
+
const close = () => {
|
|
25
|
+
setShowModal(false);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const idleTimeout = () => {
|
|
29
|
+
const popupExists = sessionStorage.getItem('popstate');
|
|
30
|
+
if (!popupExists) {
|
|
31
|
+
setShowModal(true);
|
|
32
|
+
sessionStorage.setItem('popstate', true);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const onMouseLeave = () => {
|
|
37
|
+
const popupExists = sessionStorage.getItem('popstate');
|
|
38
|
+
if (!popupExists) {
|
|
39
|
+
setShowModal(true);
|
|
40
|
+
sessionStorage.setItem('popstate', true);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const handleEsc = (event) => {
|
|
45
|
+
if (event.keyCode === 27) {
|
|
46
|
+
close();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const handleOutsideClick = (event) => {
|
|
51
|
+
if (
|
|
52
|
+
modal.current &&
|
|
53
|
+
!modal.current.contains(event.target) &&
|
|
54
|
+
!modal.current.previousElementSibling.contains(event.target)
|
|
55
|
+
) {
|
|
56
|
+
close();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (showModal) {
|
|
62
|
+
modal.current.classList.toggle(styles.activeModal);
|
|
63
|
+
} else {
|
|
64
|
+
modal.current.classList.remove(styles.activeModal);
|
|
65
|
+
}
|
|
66
|
+
}, [showModal]);
|
|
67
|
+
|
|
68
|
+
// Close on esc
|
|
69
|
+
// Close on outside click
|
|
70
|
+
// Show Popup on Idle and on window leave
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
const expireSeconds = 20;
|
|
73
|
+
setIdleTimeout(expireSeconds, idleTimeout);
|
|
74
|
+
isStorybook && setShowModal(true);
|
|
75
|
+
window.addEventListener('keydown', handleEsc);
|
|
76
|
+
window.addEventListener('mousedown', handleOutsideClick);
|
|
77
|
+
document.addEventListener('mouseleave', onMouseLeave);
|
|
78
|
+
|
|
79
|
+
// Clean up event listeners after popup is closed
|
|
80
|
+
return () => {
|
|
81
|
+
window.removeEventListener('keydown', handleEsc);
|
|
82
|
+
window.removeEventListener('mousedown', handleOutsideClick);
|
|
83
|
+
document.removeEventListener('mouseleave', onMouseLeave);
|
|
84
|
+
};
|
|
85
|
+
}, []);
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<div className={`${styles.modalInner} ${style && styles[style]}`} ref={modal}>
|
|
89
|
+
<div className={styles.modalOverlay} onClick={close}>
|
|
90
|
+
<div className={styles.popupCenter}>
|
|
91
|
+
<div className={styles.modalContent}>
|
|
92
|
+
<div className={styles.modalTitle}>
|
|
93
|
+
<p>{translate(translations, 'claim_bonuses', 'Claim These Exclusive Bonuses')}</p>
|
|
94
|
+
<button className={styles.closeIcon} onClick={close}>
|
|
95
|
+
<MdClose />
|
|
96
|
+
</button>
|
|
97
|
+
</div>
|
|
98
|
+
{shownItems?.map((item) => (
|
|
99
|
+
<PopupCard item={item} translations={translations} />
|
|
100
|
+
))}
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
Popup.propTypes = {
|
|
109
|
+
module: PropTypes.shape({
|
|
110
|
+
items: PropTypes.arrayOf({}),
|
|
111
|
+
style: PropTypes.string,
|
|
112
|
+
}).isRequired,
|
|
113
|
+
translations: PropTypes.shape({}),
|
|
114
|
+
isStorybook: PropTypes.bool,
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export default Popup;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
.modalInner {
|
|
2
|
+
display: none;
|
|
3
|
+
|
|
4
|
+
&.activeModal {
|
|
5
|
+
display: flex;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
align-items: center;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&.desktop_only {
|
|
11
|
+
@include max(laptop) {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&.mobile_only {
|
|
17
|
+
@include min(laptop) {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.modalOverlay {
|
|
24
|
+
position: fixed;
|
|
25
|
+
display: block;
|
|
26
|
+
z-index: map-get($z-index, modal);
|
|
27
|
+
background-color: white;
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
top: 0;
|
|
31
|
+
left: 0;
|
|
32
|
+
overflow: auto;
|
|
33
|
+
background-color: #000;
|
|
34
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
35
|
+
transition: opacity 0.15s linear;
|
|
36
|
+
|
|
37
|
+
.popupCenter {
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 100%;
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
align-items: center;
|
|
43
|
+
|
|
44
|
+
@include min(tablet) {
|
|
45
|
+
justify-content: center;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.modalContent {
|
|
50
|
+
background: #fff;
|
|
51
|
+
color: #171f49;
|
|
52
|
+
padding: 0.8rem 2.4rem;
|
|
53
|
+
width: 90%;
|
|
54
|
+
border-radius: 1rem;
|
|
55
|
+
margin-top: 5rem;
|
|
56
|
+
position: relative;
|
|
57
|
+
|
|
58
|
+
@include min(tablet) {
|
|
59
|
+
max-width: 68rem;
|
|
60
|
+
min-width: 68rem;
|
|
61
|
+
margin-top: 0;
|
|
62
|
+
width: auto;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.modalTitle {
|
|
66
|
+
> p {
|
|
67
|
+
font-size: 1.8rem;
|
|
68
|
+
margin-bottom: 1rem;
|
|
69
|
+
margin-top: 1rem;
|
|
70
|
+
line-height: 2.5rem;
|
|
71
|
+
font-weight: 700;
|
|
72
|
+
text-align: left;
|
|
73
|
+
padding-right: 1.6rem;
|
|
74
|
+
|
|
75
|
+
@include min(tablet) {
|
|
76
|
+
margin-top: 3.2rem;
|
|
77
|
+
font-size: 2rem;
|
|
78
|
+
line-height: 3rem;
|
|
79
|
+
margin-top: 1.2rem;
|
|
80
|
+
margin-bottom: 1.3rem;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.closeIcon {
|
|
86
|
+
position: absolute;
|
|
87
|
+
top: 1.5rem;
|
|
88
|
+
right: 1.5rem;
|
|
89
|
+
|
|
90
|
+
> svg {
|
|
91
|
+
width: 2.4rem;
|
|
92
|
+
height: 2.4rem;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
+
import {
|
|
4
|
+
Title,
|
|
5
|
+
Description,
|
|
6
|
+
Primary,
|
|
7
|
+
PRIMARY_STORY,
|
|
8
|
+
ArgsTable,
|
|
9
|
+
} from '@storybook/addon-docs/blocks';
|
|
10
|
+
import { singleToplistData } from 'gatsby-core-theme/tests/factories/modules/toplist.factory';
|
|
11
|
+
|
|
12
|
+
import Popup from '.';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
title: 'Matrix-Theme/Organisms/Popup',
|
|
16
|
+
component: Popup,
|
|
17
|
+
argTypes: {
|
|
18
|
+
module: {
|
|
19
|
+
name: 'module',
|
|
20
|
+
type: { name: 'object', required: true },
|
|
21
|
+
defaultValue: '',
|
|
22
|
+
description: 'Module object',
|
|
23
|
+
table: {
|
|
24
|
+
type: { summary: 'object' },
|
|
25
|
+
defaultValue: { summary: '' },
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
translations: {
|
|
29
|
+
name: 'translations',
|
|
30
|
+
type: { name: 'object', required: true },
|
|
31
|
+
defaultValue: '',
|
|
32
|
+
description: 'Translations object',
|
|
33
|
+
table: {
|
|
34
|
+
type: { summary: 'object' },
|
|
35
|
+
defaultValue: { summary: '' },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
parameters: {
|
|
40
|
+
docs: {
|
|
41
|
+
description: {
|
|
42
|
+
component: 'A component that displays toplist Popup',
|
|
43
|
+
},
|
|
44
|
+
page: () => (
|
|
45
|
+
<>
|
|
46
|
+
<Title />
|
|
47
|
+
<Description />
|
|
48
|
+
<Primary />
|
|
49
|
+
<ArgsTable story={PRIMARY_STORY} />
|
|
50
|
+
</>
|
|
51
|
+
),
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const Template = (args) => <Popup {...args} />;
|
|
57
|
+
export const Default = Template.bind({});
|
|
58
|
+
Default.args = {
|
|
59
|
+
isStorybook: true,
|
|
60
|
+
module: singleToplistData,
|
|
61
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, cleanup, fireEvent } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
4
|
+
import { singleToplistData } from 'gatsby-core-theme/tests/factories/modules/toplist.factory';
|
|
5
|
+
|
|
6
|
+
import Popup from '.';
|
|
7
|
+
|
|
8
|
+
const module = singleToplistData;
|
|
9
|
+
|
|
10
|
+
describe('Popup test component', () => {
|
|
11
|
+
test('render', () => {
|
|
12
|
+
const { container, getByText } = render(<Popup module={module} />);
|
|
13
|
+
expect(container).toBeTruthy();
|
|
14
|
+
expect(getByText('Claim These Exclusive Bonuses'));
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('Popup Rows and click close button', () => {
|
|
18
|
+
const { container } = render(<Popup module={module} isStorybook />);
|
|
19
|
+
const rows = container.querySelectorAll('.popupCard');
|
|
20
|
+
expect(rows).toHaveLength(4);
|
|
21
|
+
expect(container.querySelectorAll('img')).toHaveLength(4);
|
|
22
|
+
|
|
23
|
+
let isVisible = container.querySelector('.activeModal');
|
|
24
|
+
expect(isVisible).toBeTruthy();
|
|
25
|
+
|
|
26
|
+
fireEvent.click(container.querySelector('.closeIcon'));
|
|
27
|
+
isVisible = container.querySelector('.activeModal');
|
|
28
|
+
expect(isVisible).toBeFalsy();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
afterEach(() => {
|
|
32
|
+
cleanup();
|
|
33
|
+
});
|
|
File without changes
|
|
@@ -9,9 +9,9 @@ import keygen from 'gatsby-core-theme/src/helpers/keygen';
|
|
|
9
9
|
import { translate } from 'gatsby-core-theme/src/helpers/getters';
|
|
10
10
|
import { isMobileDevice } from 'gatsby-matrix-theme/src/helpers/mobile-detect';
|
|
11
11
|
import { TiArrowSortedDown, TiArrowSortedUp } from 'react-icons/ti';
|
|
12
|
-
import Column from '../../../atoms/table/column
|
|
13
|
-
import StaticColumn from '../../../atoms/table/staticColumn
|
|
14
|
-
import styles from './
|
|
12
|
+
import Column from '../../../atoms/table/column';
|
|
13
|
+
import StaticColumn from '../../../atoms/table/staticColumn';
|
|
14
|
+
import styles from './comparison-table.module.scss';
|
|
15
15
|
|
|
16
16
|
const Index = ({ module, page }) => {
|
|
17
17
|
const [width] = useWindowSize();
|
|
@@ -1,47 +1,42 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
4
|
+
import loadable from '@loadable/component';
|
|
3
5
|
import keygen from '~helpers/keygen';
|
|
4
6
|
import List from './list';
|
|
5
7
|
import Tabs from '~hooks/tabs';
|
|
6
8
|
import Row from '../../molecules/toplist/row/variant-one';
|
|
7
|
-
import ComparisonTable from './comparisonTable';
|
|
8
9
|
|
|
9
10
|
const TopList = ({ module, toplistHeading, CustomRow, page }) => {
|
|
10
11
|
const template = page?.template;
|
|
11
12
|
const translations = page?.translations;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/>
|
|
40
|
-
</div>
|
|
41
|
-
))}
|
|
42
|
-
</Tabs>
|
|
43
|
-
)}
|
|
44
|
-
</>
|
|
13
|
+
const ComparisonTable =
|
|
14
|
+
module?.style === 'comparison_table' ? loadable(() => import('./comparison-table')) : null;
|
|
15
|
+
|
|
16
|
+
return ComparisonTable ? (
|
|
17
|
+
<ComparisonTable
|
|
18
|
+
module={module}
|
|
19
|
+
toplistHeading={toplistHeading}
|
|
20
|
+
CustomRow={CustomRow}
|
|
21
|
+
page={page}
|
|
22
|
+
/>
|
|
23
|
+
) : (
|
|
24
|
+
<Tabs translations={page.translations} title={module.title} module={module} tabsAlign="right">
|
|
25
|
+
{module.items.map((toplist) => (
|
|
26
|
+
<div label={toplist.title} key={keygen()}>
|
|
27
|
+
{toplistHeading}
|
|
28
|
+
<List
|
|
29
|
+
toplist={toplist}
|
|
30
|
+
CustomRow={Row}
|
|
31
|
+
translations={translations}
|
|
32
|
+
hasLoadMoreButton={toplist.show_load_more}
|
|
33
|
+
initItemsCount={toplist.num_items_initial_load}
|
|
34
|
+
loadItemsCount={toplist.num_items_load_more}
|
|
35
|
+
pageTemplate={template}
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
))}
|
|
39
|
+
</Tabs>
|
|
45
40
|
);
|
|
46
41
|
};
|
|
47
42
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
2
|
import React, { useRef } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import useWindowsWidth from 'gatsby-core-theme/src/hooks/useWindowSize';
|
|
5
4
|
import { translate } from 'gatsby-core-theme/src/helpers/getters';
|
|
6
5
|
import keygen from '~helpers/keygen';
|
|
7
6
|
import Row from '~molecules/toplist/default-row';
|
|
@@ -16,7 +15,6 @@ export default function List({
|
|
|
16
15
|
loadItemsCount,
|
|
17
16
|
pageTemplate,
|
|
18
17
|
translations,
|
|
19
|
-
featuredCards = false,
|
|
20
18
|
}) {
|
|
21
19
|
const initLoadItems = Number(initItemsCount) !== 0 ? Number(initItemsCount) : 10000;
|
|
22
20
|
const loadingItems = Number(loadItemsCount) !== 0 ? Number(loadItemsCount) : 10000;
|
|
@@ -48,7 +46,6 @@ export default function List({
|
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
48
|
|
|
51
|
-
const mobileCard = useWindowsWidth()[0] < 992 ? 2 : 3;
|
|
52
49
|
return (
|
|
53
50
|
<>
|
|
54
51
|
<ul className={styles.list} key={keygen()}>
|
|
@@ -65,7 +62,7 @@ export default function List({
|
|
|
65
62
|
oneliner={toplist.one_liner}
|
|
66
63
|
isPPC={isPPCPage}
|
|
67
64
|
translations={translations}
|
|
68
|
-
|
|
65
|
+
index={index}
|
|
69
66
|
/>
|
|
70
67
|
) : (
|
|
71
68
|
<Row item={item} tracker={toplist.tracker} oneliner={toplist.one_liner} />
|
|
@@ -105,5 +102,4 @@ List.propTypes = {
|
|
|
105
102
|
loadItemsCount: PropTypes.string,
|
|
106
103
|
pageTemplate: PropTypes.string,
|
|
107
104
|
translations: PropTypes.shape({}),
|
|
108
|
-
featuredCards: PropTypes.bool,
|
|
109
105
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
|
-
import Cards from '../../../../../components/organisms/cards';
|
|
4
|
+
// import Cards from '../../../../../components/organisms/cards';
|
|
5
|
+
import Cards from 'gatsby-core-theme/src/components/organisms/cards';
|
|
5
6
|
|
|
6
7
|
// Test included with archive & cards test
|
|
7
8
|
const Items = ({ module, page }) => <Cards module={module} page={page} />;
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,123 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { FaAngleRight } from 'react-icons/fa';
|
|
4
|
+
import { translate } from 'gatsby-core-theme/src/helpers/getters';
|
|
2
5
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
-
import
|
|
6
|
+
import styles from './module-title.module.scss';
|
|
7
|
+
import Link from '~hooks/link';
|
|
4
8
|
|
|
5
|
-
const
|
|
9
|
+
const ModuleTitle = ({
|
|
10
|
+
module,
|
|
11
|
+
viewMoreIcon = <FaAngleRight />,
|
|
12
|
+
pageContext = null,
|
|
13
|
+
translations,
|
|
14
|
+
}) => {
|
|
15
|
+
const tabsToplist = module?.items?.length > 1 && module?.name === 'top_list';
|
|
16
|
+
const CustomTag = `${module.module_title_tag}`;
|
|
17
|
+
const monthNames = [
|
|
18
|
+
'January',
|
|
19
|
+
'February',
|
|
20
|
+
'March',
|
|
21
|
+
'April',
|
|
22
|
+
'May',
|
|
23
|
+
'June',
|
|
24
|
+
'July',
|
|
25
|
+
'August',
|
|
26
|
+
'September',
|
|
27
|
+
'October',
|
|
28
|
+
'November',
|
|
29
|
+
'December',
|
|
30
|
+
];
|
|
31
|
+
const d = new Date();
|
|
32
|
+
const year = d.getFullYear();
|
|
33
|
+
const month = monthNames[d.getMonth()];
|
|
34
|
+
const currentMonth = module.show_last_updated_date
|
|
35
|
+
? translate(translations, month, month)
|
|
36
|
+
: false;
|
|
37
|
+
const getTitle = () => {
|
|
38
|
+
if (!module?.module_title_tag) {
|
|
39
|
+
return (
|
|
40
|
+
<h2 className={styles.noTag}>
|
|
41
|
+
{module.title}
|
|
42
|
+
{currentMonth ? (
|
|
43
|
+
<span className={styles.toplistDate}>
|
|
44
|
+
<small>•</small>
|
|
45
|
+
{`${currentMonth} ${year}`}
|
|
46
|
+
</span>
|
|
47
|
+
) : null}
|
|
48
|
+
</h2>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
6
51
|
|
|
7
|
-
|
|
52
|
+
if (module.module_title_tag)
|
|
53
|
+
return (
|
|
54
|
+
<CustomTag>
|
|
55
|
+
{module.module_title}
|
|
56
|
+
{currentMonth ? (
|
|
57
|
+
<span className={styles.toplistDate}>
|
|
58
|
+
<small>•</small>
|
|
59
|
+
{`${currentMonth} ${year}`}
|
|
60
|
+
</span>
|
|
61
|
+
) : null}
|
|
62
|
+
</CustomTag>
|
|
63
|
+
);
|
|
64
|
+
return (
|
|
65
|
+
<span className={styles.noTag}>
|
|
66
|
+
{module.module_title}
|
|
67
|
+
{currentMonth ? (
|
|
68
|
+
<span className={styles.toplistDate}>
|
|
69
|
+
<small>•</small>
|
|
70
|
+
{`${currentMonth} ${year}`}
|
|
71
|
+
</span>
|
|
72
|
+
) : null}
|
|
73
|
+
</span>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const template = pageContext && pageContext?.page?.template;
|
|
78
|
+
return (
|
|
79
|
+
<div className={`${tabsToplist ? styles.tabsToplist : null}`}>
|
|
80
|
+
{(module.module_title ||
|
|
81
|
+
module.link_label ||
|
|
82
|
+
(module.title && (module.name === 'cards' || module.name === 'top_list'))) && (
|
|
83
|
+
<div
|
|
84
|
+
className={`${styles.moduleTitle} ${styles[template]} ${
|
|
85
|
+
module?.style && styles[module.style]
|
|
86
|
+
}`}
|
|
87
|
+
>
|
|
88
|
+
<span className={styles.spanToplist}>
|
|
89
|
+
{(module?.title || module.module_title) && getTitle(module)}
|
|
90
|
+
</span>
|
|
91
|
+
|
|
92
|
+
{module.link_label && (
|
|
93
|
+
<Link to={module.link_value} className={styles.viewMore}>
|
|
94
|
+
{module.link_label}
|
|
95
|
+
{viewMoreIcon}
|
|
96
|
+
</Link>
|
|
97
|
+
)}
|
|
98
|
+
</div>
|
|
99
|
+
)}
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
ModuleTitle.propTypes = {
|
|
105
|
+
module: PropTypes.shape({
|
|
106
|
+
module_title: PropTypes.string,
|
|
107
|
+
module_title_tag: PropTypes.string,
|
|
108
|
+
link_label: PropTypes.string,
|
|
109
|
+
link_value: PropTypes.string,
|
|
110
|
+
name: PropTypes.string,
|
|
111
|
+
style: PropTypes.string,
|
|
112
|
+
items: PropTypes.shape({
|
|
113
|
+
length: PropTypes.number,
|
|
114
|
+
}),
|
|
115
|
+
show_last_updated_date: PropTypes.string,
|
|
116
|
+
title: PropTypes.string,
|
|
117
|
+
}),
|
|
118
|
+
viewMoreIcon: PropTypes.element,
|
|
119
|
+
pageContext: PropTypes.shape({}),
|
|
120
|
+
translations: PropTypes.shape({}),
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export default ModuleTitle;
|
|
File without changes
|
package/src/{components → gatsby-core-theme/components}/atoms/spotlights/spotlights.module.scss
RENAMED
|
File without changes
|
|
@@ -32,28 +32,39 @@ const Content = ({ module }) => {
|
|
|
32
32
|
};
|
|
33
33
|
return <LazyImage {...lazyProps} />;
|
|
34
34
|
}
|
|
35
|
+
|
|
36
|
+
if (node.name === 'p' && module.style === 'horizontal_image_scroll_mobile') {
|
|
37
|
+
const hasChildImg = node?.children.find((child) => child?.name === 'img');
|
|
38
|
+
|
|
39
|
+
if (hasChildImg && node.nodeType === 1) {
|
|
40
|
+
node.attribs.style = 'overflow-x: scroll';
|
|
41
|
+
return node;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
35
45
|
return null;
|
|
36
46
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (tableClass === 'table_1') {
|
|
47
|
+
const switchStyle = (style) => {
|
|
48
|
+
switch (style) {
|
|
49
|
+
case 'table_1':
|
|
41
50
|
return `${styles.tableResponsive} ${styles.firstTable}`;
|
|
42
|
-
|
|
43
|
-
if (tableClass === 'table_2') {
|
|
51
|
+
case 'table_2':
|
|
44
52
|
return `${styles.tableResponsive} ${styles.secondTable}`;
|
|
45
|
-
|
|
46
|
-
if (tableClass === 'default_table') {
|
|
53
|
+
case 'default_table':
|
|
47
54
|
return `${styles.tableResponsive}`;
|
|
48
|
-
|
|
55
|
+
case 'content_frame_style':
|
|
56
|
+
return `${styles.tableResponsive} ${styles.contentFrame}`;
|
|
57
|
+
case 'horizontal_image_scroll_mobile':
|
|
58
|
+
return `${styles.horizontalScrollImage}`;
|
|
59
|
+
default:
|
|
60
|
+
return null;
|
|
49
61
|
}
|
|
50
|
-
return '';
|
|
51
62
|
};
|
|
52
63
|
|
|
53
64
|
return (
|
|
54
65
|
<>
|
|
55
66
|
<div className={styles.content}>
|
|
56
|
-
<div className={`${
|
|
67
|
+
<div className={`${switchStyle(module.style)}`}>
|
|
57
68
|
{module.value &&
|
|
58
69
|
parse(module.value, {
|
|
59
70
|
replace: replaceMedia,
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import LinkList from 'gatsby-core-theme/src/components/molecules/link-list';
|
|
4
4
|
import { getExtraField, copyrightText } from 'gatsby-core-theme/src/helpers/getters';
|
|
5
|
-
// import styles from 'gatsby-core-theme/src/components/molecules/footer/footer.module.scss';
|
|
6
5
|
import styles from './footer.module.scss';
|
|
7
6
|
/* eslint-disable react/no-danger */
|
|
8
7
|
|