gatsby-core-theme 3.0.0 → 4.0.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 +59 -0
- package/__mocks__/gatsby.js +16 -4
- package/gatsby-node.esm.js +7 -1
- package/jest.config.js +8 -1
- package/package.json +1 -1
- package/src/components/app.js +1 -17
- package/src/components/atoms/author/author.test.js +12 -5
- package/src/components/atoms/author-box/index.js +9 -11
- package/src/components/atoms/breadcrumbs/breadcrumbs.test.js +8 -0
- package/src/components/atoms/carousel/pagination-item/pagination-item.test.js +18 -3
- package/src/components/atoms/collapse/collapse.test.js +10 -0
- package/src/components/atoms/collapse/index.js +3 -1
- package/src/components/atoms/content-box/content-box.test.js +9 -6
- package/src/components/atoms/content-box/index.js +13 -12
- package/src/components/atoms/custom-select/index.js +31 -30
- package/src/components/atoms/disclaimer/disclaimer.test.js +16 -1
- package/src/components/atoms/iframe/iframe.module.scss +3 -0
- package/src/components/atoms/iframe/iframe.test.js +6 -0
- package/src/components/atoms/image/image.test.js +19 -6
- package/src/components/atoms/image/index.js +2 -4
- package/src/components/atoms/info-grid/index.js +10 -12
- package/src/components/atoms/label/index.js +2 -2
- package/src/components/atoms/label/label.test.js +4 -0
- package/src/components/atoms/module-title/index.js +9 -9
- package/src/components/atoms/module-title/module-title.test.js +76 -0
- package/src/components/atoms/open-graph/open-graph.test.js +34 -5
- package/src/components/atoms/operator-cta/operator-cta.test.js +26 -3
- package/src/components/atoms/scroll-to-top/scroll-to-top.test.js +6 -0
- package/src/components/atoms/search/autocomplete/operator.js +1 -1
- package/src/components/atoms/sitemap/index.js +1 -1
- package/src/components/atoms/spotlights/index.js +55 -53
- package/src/components/atoms/spotlights/spotlights.module.scss +25 -37
- package/src/components/atoms/spotlights/spotlights.test.js +13 -15
- package/src/components/molecules/content/content.test.js +127 -0
- package/src/components/molecules/content/index.js +0 -1
- package/src/components/molecules/header/header.test.js +6 -0
- package/src/components/molecules/main/main.test.js +48 -12
- package/src/components/molecules/menu/menu.test.js +27 -0
- package/src/components/molecules/module/module.test.js +134 -0
- package/src/components/molecules/operator-banner/operator-banner.test.js +7 -1
- package/src/components/molecules/pagination/pagination-with-midpoints.module.scss +48 -49
- package/src/components/organisms/cookie-consent/cookie-consent.test.js +7 -1
- package/src/components/organisms/form/form.test.js +21 -0
- package/src/components/organisms/form/index.js +5 -1
- package/src/components/organisms/navigation/index.js +9 -1
- package/src/components/organisms/search/index.js +0 -1
- package/src/components/organisms/toplist/list/index.js +1 -1
- package/src/components/organisms/toplist/list/list.test.js +30 -0
- package/src/components/pages/body/index.js +4 -6
- package/src/components/pages/tracker/index.js +1 -1
- package/src/constants/settings.js +1 -1
- package/src/helpers/getters.js +1 -6
- package/src/helpers/getters.test.js +1 -3
- package/src/helpers/processor/common.test.js +7 -1
- package/src/helpers/processor/index.js +2 -3
- package/src/helpers/processor/index.test.js +21 -0
- package/src/helpers/schema.js +1 -1
- package/src/helpers/schema.test.js +4 -4
- package/src/hooks/gatsby-img/index.js +1 -1
- package/src/hooks/lazy-image/index.js +1 -1
- package/src/hooks/lazy-image/lazy-image.test.js +39 -0
- package/src/hooks/lazy-picture/index.js +1 -1
- package/src/hooks/link/link.test.js +42 -1
- package/src/hooks/tabs/tab/tab.test.js +41 -0
- package/src/styles/utils/variables/_main.scss +3 -1
- package/tests/envVars.js +1 -1
- package/tests/factories/modules/content.factory.js +6 -3
- package/tests/factories/modules/modules.factory.js +152 -0
- package/tests/factories/modules/schema.factory.js +87 -0
- package/tests/factories/pages/list.factory.js +2 -1
- package/tests/factories/pages/pages.factory.js +192 -0
- package/tests/factories/sections/header.factory.js +8 -2
- package/src/components/atoms/logo/index.js +0 -36
- package/src/components/atoms/logo/logo.module.scss +0 -4
- package/src/components/atoms/logo/logo.stories.js +0 -57
- package/src/components/atoms/logo/logo.test.js +0 -30
- package/src/components/molecules/section/index.js +0 -24
- package/src/components/molecules/section/section.test.js +0 -16
- package/src/components/molecules/sidebar/index.js +0 -25
- package/src/components/molecules/sidebar/sidebar.module.scss +0 -3
- package/src/components/molecules/sidebar/sidebar.test.js +0 -30
|
@@ -10,8 +10,8 @@ const Label = ({ title = '', bgColor = 'yellow' }) => (
|
|
|
10
10
|
);
|
|
11
11
|
|
|
12
12
|
Label.propTypes = {
|
|
13
|
-
title: PropTypes.string
|
|
14
|
-
bgColor: PropTypes.string
|
|
13
|
+
title: PropTypes.string,
|
|
14
|
+
bgColor: PropTypes.string,
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export default Label;
|
|
@@ -12,6 +12,10 @@ describe('Label Component', () => {
|
|
|
12
12
|
expect(myLabel).toBeTruthy();
|
|
13
13
|
expect(myLabel.getAttribute('style')).toEqual('background-color: blue;');
|
|
14
14
|
});
|
|
15
|
+
test('render with props', () => {
|
|
16
|
+
const { container } = render(<Label />);
|
|
17
|
+
expect(container.querySelector('span')).toBeEmptyDOMElement();
|
|
18
|
+
});
|
|
15
19
|
});
|
|
16
20
|
afterEach(() => {
|
|
17
21
|
cleanup();
|
|
@@ -14,15 +14,15 @@ const ModuleTitle = ({ module, viewMoreIcon = <FaAngleRight />, pageContext = nu
|
|
|
14
14
|
if (module.module_title_tag === 'h6') return <h6>{module.module_title}</h6>;
|
|
15
15
|
return <span className={styles.noTag}>{module.module_title}</span>;
|
|
16
16
|
};
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
) {
|
|
24
|
-
|
|
25
|
-
}
|
|
17
|
+
// if (
|
|
18
|
+
// module.name === 'content' &&
|
|
19
|
+
// (module.module_title === 'table' ||
|
|
20
|
+
// module.module_title === 'table-1' ||
|
|
21
|
+
// module.module_title === 'table-2' ||
|
|
22
|
+
// (module.style && module.style.includes('table')))
|
|
23
|
+
// ) {
|
|
24
|
+
// return null;
|
|
25
|
+
// }
|
|
26
26
|
|
|
27
27
|
const template = pageContext && pageContext?.page?.template;
|
|
28
28
|
|
|
@@ -37,6 +37,82 @@ describe('Module Title Component', () => {
|
|
|
37
37
|
expect(getByText('View More')).toBeTruthy();
|
|
38
38
|
expect(container.querySelector('a.viewMore').getAttribute('href')).toEqual('/more');
|
|
39
39
|
});
|
|
40
|
+
|
|
41
|
+
test('all H elements', () => {
|
|
42
|
+
const arr = ['h2', 'h3', 'h4', 'h5', 'h6'];
|
|
43
|
+
|
|
44
|
+
const madeObj = (current) => {
|
|
45
|
+
const obj = {
|
|
46
|
+
module_title_tag: current,
|
|
47
|
+
module_title: `Title with current + ${current} `,
|
|
48
|
+
};
|
|
49
|
+
return obj;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const arrWithObj = arr.reduce((acc, current) => {
|
|
53
|
+
acc.push(madeObj(current));
|
|
54
|
+
return acc;
|
|
55
|
+
}, []);
|
|
56
|
+
|
|
57
|
+
arrWithObj.forEach((element) => {
|
|
58
|
+
const { container } = render(
|
|
59
|
+
<ModuleTitle
|
|
60
|
+
module={{
|
|
61
|
+
name: 'content',
|
|
62
|
+
module_title: element.module_title,
|
|
63
|
+
module_title_tag: element.module_title_tag,
|
|
64
|
+
link_label: 'View More',
|
|
65
|
+
link_value: '/all',
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
expect(container.querySelector(element.module_title_tag)).toBeTruthy();
|
|
71
|
+
// expect(container.querySelector(element.module_title_tag)).toHaveLength(1)
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('test', () => {
|
|
76
|
+
const { getByText } = render(
|
|
77
|
+
<ModuleTitle
|
|
78
|
+
module={{
|
|
79
|
+
name: 'TestName',
|
|
80
|
+
module_title: 'Test',
|
|
81
|
+
module_title_tag: '',
|
|
82
|
+
link_label: 'View More',
|
|
83
|
+
link_value: '/all',
|
|
84
|
+
}}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
expect(getByText('Test')).toBeTruthy();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('with pageContext', () => {
|
|
92
|
+
const { container, getByText } = render(
|
|
93
|
+
<ModuleTitle
|
|
94
|
+
module={{
|
|
95
|
+
name: 'content',
|
|
96
|
+
module_title: 'Test Title',
|
|
97
|
+
module_title_tag: 'h2',
|
|
98
|
+
link_label: 'View More',
|
|
99
|
+
link_value: '/all',
|
|
100
|
+
style: 'Style test',
|
|
101
|
+
}}
|
|
102
|
+
pageContext={{
|
|
103
|
+
page: {
|
|
104
|
+
template: true,
|
|
105
|
+
},
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
expect(getByText('Test Title')).toBeTruthy();
|
|
111
|
+
expect(container.querySelector('a')).toHaveAttribute('href', '/all');
|
|
112
|
+
expect(container.querySelectorAll('a')).toHaveLength(1);
|
|
113
|
+
expect(getByText('View More')).toBeTruthy();
|
|
114
|
+
expect(container.querySelectorAll('svg')).toHaveLength(1);
|
|
115
|
+
});
|
|
40
116
|
});
|
|
41
117
|
afterEach(() => {
|
|
42
118
|
cleanup();
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
/* eslint-disable no-lone-blocks */
|
|
2
|
+
/* eslint-disable no-unused-expressions */
|
|
1
3
|
import React from 'react';
|
|
2
|
-
import { render, cleanup } from '@testing-library/react';
|
|
4
|
+
import { render, cleanup, fireEvent } from '@testing-library/react';
|
|
3
5
|
import { getUrl } from '~helpers/getters';
|
|
4
6
|
import '@testing-library/jest-dom/extend-expect';
|
|
5
7
|
|
|
@@ -11,18 +13,45 @@ describe('OpenGraph Component', () => {
|
|
|
11
13
|
<OpenGraph
|
|
12
14
|
text="test title"
|
|
13
15
|
page={{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
title: 'test',
|
|
17
|
+
path: '/test/path',
|
|
16
18
|
}}
|
|
17
19
|
/>
|
|
18
20
|
);
|
|
21
|
+
global.open = jest.fn();
|
|
19
22
|
|
|
20
|
-
const fbURL = `https://www.facebook.com/sharer/sharer.php?caption=test&u=${getUrl(
|
|
23
|
+
const fbURL = `https://www.facebook.com/sharer/sharer.php?caption=test&u=${getUrl(
|
|
24
|
+
'/test/path'
|
|
25
|
+
)}`;
|
|
21
26
|
const twitterURL = `https://twitter.com/intent/tweet?text=test&url=${getUrl('/test/path')}`;
|
|
22
27
|
|
|
23
28
|
expect(getByText('test title')).toBeTruthy();
|
|
29
|
+
expect(container.querySelectorAll('svg')).toHaveLength(2);
|
|
24
30
|
expect(container.querySelectorAll('a')[0]).toHaveAttribute('href', fbURL);
|
|
25
|
-
|
|
31
|
+
expect(container.querySelectorAll('a')[1]).toHaveAttribute('href', twitterURL);
|
|
32
|
+
|
|
33
|
+
const firstAhref = container.querySelectorAll('a')[0];
|
|
34
|
+
const secondAhref = container.querySelectorAll('a')[1];
|
|
35
|
+
// eslint-disable-next-line no-lone-blocks
|
|
36
|
+
{
|
|
37
|
+
firstAhref && fireEvent.click(firstAhref);
|
|
38
|
+
}
|
|
39
|
+
{
|
|
40
|
+
secondAhref && fireEvent.click(secondAhref);
|
|
41
|
+
}
|
|
42
|
+
expect(global.open).toBeCalled();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('Render component without Title', () => {
|
|
46
|
+
const { getByText } = render(
|
|
47
|
+
<OpenGraph
|
|
48
|
+
page={{
|
|
49
|
+
title: 'test2',
|
|
50
|
+
path: '/test2/path',
|
|
51
|
+
}}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
expect(getByText('Share:')).toBeTruthy();
|
|
26
55
|
});
|
|
27
56
|
});
|
|
28
57
|
afterEach(() => {
|
|
@@ -14,9 +14,15 @@ describe('OperatorCta Component', () => {
|
|
|
14
14
|
// });
|
|
15
15
|
|
|
16
16
|
// test('test closedCasino', () => {
|
|
17
|
-
// const
|
|
18
|
-
//
|
|
19
|
-
//
|
|
17
|
+
// const data = getPageData().relation;
|
|
18
|
+
// const obj = {
|
|
19
|
+
// ...data,
|
|
20
|
+
// status: 'closed',
|
|
21
|
+
// };
|
|
22
|
+
// const { container, getByText } = render(
|
|
23
|
+
// <OperatorCta closedCasinoText="test2" operator={obj} />
|
|
24
|
+
// );
|
|
25
|
+
// // expect(container.querySelector('.closed')).toBeTruthy();
|
|
20
26
|
// });
|
|
21
27
|
|
|
22
28
|
// test('test Active CTA', () => {
|
|
@@ -24,6 +30,12 @@ describe('OperatorCta Component', () => {
|
|
|
24
30
|
// expect(getByText('test3')).toBeTruthy();
|
|
25
31
|
// });
|
|
26
32
|
|
|
33
|
+
const inactiveOperator = {
|
|
34
|
+
bonus: { tax_free: false, min_deposit: '0', min_withdrawal: '', max_withdrawal: '' },
|
|
35
|
+
short_name: 'the_lotter',
|
|
36
|
+
status: 'inactive',
|
|
37
|
+
};
|
|
38
|
+
|
|
27
39
|
test('test GTM class', () => {
|
|
28
40
|
const data = getPageData();
|
|
29
41
|
const { getByText } = render(
|
|
@@ -33,6 +45,17 @@ describe('OperatorCta Component', () => {
|
|
|
33
45
|
expect(getByText('test3').closest('a').classList.contains('operator-cta-gtm')).toBe(true);
|
|
34
46
|
expect(getByText('test3').closest('a').classList.contains('btn-cta')).toBe(true);
|
|
35
47
|
});
|
|
48
|
+
|
|
49
|
+
test('test closed status', () => {
|
|
50
|
+
const { getByText } = render(
|
|
51
|
+
<OperatorCta
|
|
52
|
+
operator={inactiveOperator}
|
|
53
|
+
closedCasinoText="isClosedd"
|
|
54
|
+
placeholderText="test"
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
expect(getByText('isClosedd')).toBeTruthy();
|
|
58
|
+
});
|
|
36
59
|
});
|
|
37
60
|
afterEach(() => {
|
|
38
61
|
cleanup();
|
|
@@ -18,6 +18,12 @@ describe('ScrollToTop Component', () => {
|
|
|
18
18
|
fireEvent.click(btn);
|
|
19
19
|
expect(scrollToSpy).toHaveBeenCalled();
|
|
20
20
|
});
|
|
21
|
+
|
|
22
|
+
test('on scroll', () => {
|
|
23
|
+
render(<ScrollToTop scrollTo="50" />);
|
|
24
|
+
fireEvent.scroll(window, { target: { pageYOffset: 501 } });
|
|
25
|
+
fireEvent.scroll(window, { target: { pageYOffset: 301 } });
|
|
26
|
+
});
|
|
21
27
|
});
|
|
22
28
|
afterEach(() => {
|
|
23
29
|
cleanup();
|
|
@@ -8,7 +8,7 @@ import styles from './operator.module.scss';
|
|
|
8
8
|
|
|
9
9
|
const Operator = ({ item = {} }) => (
|
|
10
10
|
<div className={styles.row}>
|
|
11
|
-
<LazyImage src={imagePrettyUrl(item.relation.logo_url, null, 20)} />
|
|
11
|
+
<LazyImage src={imagePrettyUrl(item.relation.logo_url, null, 20)} alt={item.title} />
|
|
12
12
|
<h3>{item.title}</h3>
|
|
13
13
|
<Button to="/#" primaryColor isInternalLink={false} gtmClass="operator-gtm btn-cta" />
|
|
14
14
|
</div>
|
|
@@ -42,7 +42,7 @@ const Sitemap = ({ pageContext, templateIcon = <BiSitemap />, linkIcon = <IoMdLi
|
|
|
42
42
|
if (page !== undefined) {
|
|
43
43
|
const pageObj = sitemapData[market][template][page];
|
|
44
44
|
return (
|
|
45
|
-
<li>
|
|
45
|
+
<li key={page}>
|
|
46
46
|
{linkIcon && linkIcon}
|
|
47
47
|
<Link to={pageObj.path} title={pageObj.title}>
|
|
48
48
|
{pageObj.title}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable jsx-a11y/label-has-associated-control */
|
|
1
2
|
/* eslint-disable react/no-danger */
|
|
2
3
|
/* eslint-disable camelcase */
|
|
3
4
|
import React from 'react';
|
|
@@ -10,40 +11,41 @@ import { imagePrettyUrl } from '~helpers/getters';
|
|
|
10
11
|
import Link from '~hooks/link';
|
|
11
12
|
import styles from './spotlights.module.scss';
|
|
12
13
|
|
|
13
|
-
const Spotlights = ({ module }) => {
|
|
14
|
+
const Spotlights = ({ module, themeStyles = {} }) => {
|
|
14
15
|
const { show_read_more, read_more_text, items, mode } = module;
|
|
15
16
|
|
|
16
17
|
const content = (item) => {
|
|
17
18
|
const img = mode === 'icon' ? item.icon : item.image;
|
|
18
19
|
return (
|
|
19
20
|
<>
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
</span>
|
|
28
|
-
<div className={styles.content}>
|
|
29
|
-
<span className={styles.label}>{item.label}</span>
|
|
30
|
-
{item.subtitle && <span className={styles.subtitle}>{item.subtitle}</span>}
|
|
31
|
-
</div>
|
|
21
|
+
<LazyImage
|
|
22
|
+
width={100}
|
|
23
|
+
height={50}
|
|
24
|
+
alt={item.label || item?.link_text}
|
|
25
|
+
src={imagePrettyUrl(img)}
|
|
26
|
+
/>
|
|
27
|
+
<label>{item.label}</label>
|
|
28
|
+
{item.subtitle && <span>{item.subtitle}</span>}
|
|
32
29
|
</>
|
|
33
30
|
);
|
|
34
31
|
};
|
|
35
32
|
|
|
33
|
+
const getStyle = () => {
|
|
34
|
+
if (module.style) {
|
|
35
|
+
return themeStyles[module.style] || styles[module.style];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return ``;
|
|
39
|
+
};
|
|
40
|
+
|
|
36
41
|
return (
|
|
37
|
-
<div className={`${styles.spotlightsContainer} ${
|
|
42
|
+
<div className={`${styles.spotlightsContainer} ${getStyle()}`}>
|
|
38
43
|
{show_read_more === '1' && (
|
|
39
|
-
<div
|
|
40
|
-
className={styles.spotlightstext}
|
|
41
|
-
dangerouslySetInnerHTML={{ __html: read_more_text }}
|
|
42
|
-
/>
|
|
44
|
+
<div className="spotlightstext" dangerouslySetInnerHTML={{ __html: read_more_text }} />
|
|
43
45
|
)}
|
|
44
|
-
<ul
|
|
46
|
+
<ul>
|
|
45
47
|
{items.map((item) => (
|
|
46
|
-
<li key={keygen()}
|
|
48
|
+
<li key={keygen()}>
|
|
47
49
|
{item.link.type === 'external' ? (
|
|
48
50
|
<a
|
|
49
51
|
href={item.link.value}
|
|
@@ -66,39 +68,37 @@ const Spotlights = ({ module }) => {
|
|
|
66
68
|
</Link>
|
|
67
69
|
)}
|
|
68
70
|
|
|
69
|
-
{mode === 'image_text' &&
|
|
70
|
-
|
|
71
|
-
<div
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
</div>
|
|
101
|
-
)}
|
|
71
|
+
{mode === 'image_text' &&
|
|
72
|
+
(item.link.value ? (
|
|
73
|
+
<div>
|
|
74
|
+
<div dangerouslySetInnerHTML={{ __html: item.text }} />
|
|
75
|
+
{item.link.type === 'external' ? (
|
|
76
|
+
<a
|
|
77
|
+
href={item.link.value}
|
|
78
|
+
title={item.label}
|
|
79
|
+
target="_blank"
|
|
80
|
+
rel="noreferrer"
|
|
81
|
+
className="spotlights-gtm"
|
|
82
|
+
>
|
|
83
|
+
{item.link_text ? item.link_text : 'Read More'}
|
|
84
|
+
<GrFormNextLink />
|
|
85
|
+
</a>
|
|
86
|
+
) : (
|
|
87
|
+
<Button
|
|
88
|
+
btnText={item.link_text ? item.link_text : 'Read More'}
|
|
89
|
+
invertColors
|
|
90
|
+
isAnchorLink
|
|
91
|
+
isInternalLink={item.link.type !== 'external'}
|
|
92
|
+
targetBlank={item.link.type === 'external'}
|
|
93
|
+
to={item.link.value}
|
|
94
|
+
primaryColor={false}
|
|
95
|
+
gtmClass="spotlights-gtm btn-cta"
|
|
96
|
+
/>
|
|
97
|
+
)}
|
|
98
|
+
</div>
|
|
99
|
+
) : (
|
|
100
|
+
<div dangerouslySetInnerHTML={{ __html: item.text }} />
|
|
101
|
+
))}
|
|
102
102
|
</li>
|
|
103
103
|
))}
|
|
104
104
|
</ul>
|
|
@@ -106,6 +106,8 @@ const Spotlights = ({ module }) => {
|
|
|
106
106
|
);
|
|
107
107
|
};
|
|
108
108
|
Spotlights.propTypes = {
|
|
109
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
110
|
+
themeStyles: PropTypes.object,
|
|
109
111
|
module: PropTypes.shape({
|
|
110
112
|
style: PropTypes.string,
|
|
111
113
|
mode: PropTypes.oneOf(['image', 'icon', 'image_text']).isRequired,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
margin: 0 auto;
|
|
3
3
|
width: 100%;
|
|
4
4
|
max-width: var(--main-container-max);
|
|
5
|
+
|
|
5
6
|
ul {
|
|
6
7
|
display: grid;
|
|
7
8
|
grid-template-columns: repeat(1, 1fr);
|
|
@@ -15,58 +16,45 @@
|
|
|
15
16
|
column-gap: 1.6rem;
|
|
16
17
|
}
|
|
17
18
|
li {
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
text-align: center;
|
|
20
|
+
background-color: var(--color-9);
|
|
21
|
+
border: none;
|
|
20
22
|
margin-bottom: 1rem;
|
|
23
|
+
padding: 1.5rem;
|
|
24
|
+
|
|
21
25
|
@include min(desktop) {
|
|
22
26
|
margin-bottom: 1.6rem;
|
|
23
27
|
}
|
|
28
|
+
|
|
24
29
|
@include flex-direction(column);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
.itemImage {
|
|
29
|
-
width: 100%;
|
|
30
|
-
height: 15rem;
|
|
31
|
-
img {
|
|
32
|
-
width: auto;
|
|
33
|
-
height: 100%;
|
|
34
|
-
object-fit: cover;
|
|
35
|
-
}
|
|
30
|
+
|
|
31
|
+
img {
|
|
32
|
+
margin: 0 auto;
|
|
36
33
|
}
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
> a {
|
|
36
|
+
@include flex-direction(column);
|
|
37
|
+
color: #000;
|
|
38
|
+
font-size: 2rem;
|
|
39
|
+
font-weight: 700;
|
|
40
|
+
|
|
41
|
+
label {
|
|
42
|
+
cursor: pointer;
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
span {
|
|
47
|
+
display: block;
|
|
49
48
|
}
|
|
50
|
-
|
|
49
|
+
|
|
50
|
+
> div {
|
|
51
51
|
font-size: 1.4rem;
|
|
52
52
|
color: #777;
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
@include flex-direction(row);
|
|
58
|
-
@include flex-align(center, flex-end);
|
|
59
|
-
margin: 1rem 0 0 0;
|
|
60
|
-
svg * {
|
|
61
|
-
color: blue;
|
|
62
|
-
stroke: blue;
|
|
63
|
-
}
|
|
54
|
+
|
|
55
|
+
svg {
|
|
56
|
+
display: none;
|
|
64
57
|
}
|
|
65
58
|
}
|
|
66
59
|
}
|
|
67
60
|
}
|
|
68
|
-
.spotlightstext {
|
|
69
|
-
width: 100%;
|
|
70
|
-
margin: 2rem 0;
|
|
71
|
-
font-size: 1.6rem;
|
|
72
|
-
}
|
|
@@ -9,13 +9,11 @@ describe('Spotlights Component', () => {
|
|
|
9
9
|
test('render', () => {
|
|
10
10
|
const { container, getByText } = render(<Spotlights module={getSpotlightItems(4)} />);
|
|
11
11
|
expect(container).toBeTruthy();
|
|
12
|
-
expect(container.querySelector('
|
|
13
|
-
expect(container.
|
|
14
|
-
expect(container.querySelectorAll('
|
|
15
|
-
|
|
16
|
-
expect(container.querySelectorAll('
|
|
17
|
-
expect(container.querySelectorAll('.label')).toHaveLength(4);
|
|
18
|
-
expect(container.querySelectorAll('.itemImage')).toHaveLength(4);
|
|
12
|
+
expect(container.querySelector('ul')).toBeTruthy();
|
|
13
|
+
expect(container.querySelectorAll('li')).toHaveLength(4);
|
|
14
|
+
expect(container.querySelectorAll('label')).toHaveLength(4);
|
|
15
|
+
// For images lazy loaded
|
|
16
|
+
expect(container.querySelectorAll('noscript')).toHaveLength(4);
|
|
19
17
|
expect(getByText('read more text')).toBeTruthy();
|
|
20
18
|
expect(getByText('html text 4')).toBeTruthy();
|
|
21
19
|
});
|
|
@@ -29,20 +27,20 @@ describe('Spotlights Component', () => {
|
|
|
29
27
|
test('image mode', () => {
|
|
30
28
|
const { container } = render(<Spotlights module={getSpotlightItems(3, 'image')} />);
|
|
31
29
|
expect(container).toBeTruthy();
|
|
32
|
-
expect(container.querySelector('ul
|
|
30
|
+
expect(container.querySelector('ul')).toBeTruthy();
|
|
33
31
|
expect(container.querySelectorAll('p.text')).toHaveLength(0);
|
|
34
|
-
expect(container.querySelectorAll('
|
|
35
|
-
|
|
36
|
-
expect(container.querySelectorAll('
|
|
32
|
+
expect(container.querySelectorAll('label')).toHaveLength(3);
|
|
33
|
+
// For images lazy loaded
|
|
34
|
+
expect(container.querySelectorAll('noscript')).toHaveLength(3);
|
|
37
35
|
});
|
|
38
36
|
test('icon mode', () => {
|
|
39
37
|
const { container } = render(<Spotlights module={getSpotlightItems(6, 'icon')} />);
|
|
40
38
|
expect(container).toBeTruthy();
|
|
41
|
-
expect(container.querySelector('ul
|
|
39
|
+
expect(container.querySelector('ul')).toBeTruthy();
|
|
42
40
|
expect(container.querySelectorAll('p.text')).toHaveLength(0);
|
|
43
|
-
expect(container.querySelectorAll('
|
|
44
|
-
|
|
45
|
-
expect(container.querySelectorAll('
|
|
41
|
+
expect(container.querySelectorAll('label')).toHaveLength(6);
|
|
42
|
+
// For images lazy loaded
|
|
43
|
+
expect(container.querySelectorAll('noscript')).toHaveLength(6);
|
|
46
44
|
});
|
|
47
45
|
});
|
|
48
46
|
afterEach(() => {
|