gatsby-core-theme 11.0.3 → 11.0.6
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 +44 -0
- package/package.json +1 -1
- package/src/components/atoms/author-box/index.js +5 -4
- package/src/components/atoms/button/index.js +5 -0
- package/src/components/atoms/faq/faq.module.scss +71 -0
- package/src/components/atoms/faq/faq.stories.js +92 -0
- package/src/components/atoms/faq/index.js +103 -0
- package/src/components/atoms/iframe/index.js +2 -0
- package/src/components/atoms/image/image.module.scss +7 -0
- package/src/components/atoms/image/index.js +8 -6
- package/src/components/molecules/header/index.js +1 -1
- package/src/components/molecules/module/index.js +4 -3
- package/src/components/organisms/anchor/anchor.module.scss +9 -2
- package/src/components/organisms/anchor/index.js +9 -1
- package/src/helpers/getters.js +10 -0
- package/src/helpers/getters.test.js +9 -0
- package/src/helpers/processor/index.js +13 -0
- package/src/helpers/processor/modules.js +6 -1
- package/src/hooks/link/index.js +1 -1
- package/src/components/molecules/content-intro/content-intro.module.scss +0 -2
- package/src/components/molecules/content-intro/content-intro.test.js +0 -25
- package/src/components/molecules/content-intro/index.js +0 -37
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
+
## [11.0.6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v11.0.5...v11.0.6) (2022-09-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update button and author-box ([3eec6da](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3eec6da80b37568a47ead1a15ad1811612b10828))
|
|
7
|
+
* update button component ([60cd4d1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/60cd4d1148517bdd4ef51cc265561b8137cfdcfa))
|
|
8
|
+
* update button component in order to accept props ([25cc1e3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/25cc1e31df9e468be966e3b1a7414e84dc5bace3))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
* Merge branch 'tm-3024-contact-us' into 'master' ([46e0b23](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/46e0b238e9c0c4da12a90c2dd072e6fc0fb039c7))
|
|
12
|
+
|
|
13
|
+
## [11.0.5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v11.0.4...v11.0.5) (2022-08-31)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* added placeholders for cards v2 module title ([d2ec6d7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d2ec6d7a05ab6efa4e55378e4fd40401c06e290a))
|
|
19
|
+
* removed log ([49b46e5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/49b46e55cad7686151b4bfdd4f70076d3078f370))
|
|
20
|
+
* tests ([85dcc20](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/85dcc20c53a4ca8b7dd82624bdb226037190ab8e))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
* Merge branch 'tm-2998-cardsv2-title-placeholders' into 'master' ([4dc5b17](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4dc5b1730b5c70d618a52929cf81610ee9044e82))
|
|
24
|
+
|
|
25
|
+
## [11.0.4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v11.0.3...v11.0.4) (2022-08-29)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* add progress bar in anchor ([14fcbf1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/14fcbf1958dfbf0d4c803a4e97a3c2b01506522b))
|
|
31
|
+
* added aa check in the game card provider linkage ([608de14](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/608de148afd4b5602923484e03fab36eec054a21))
|
|
32
|
+
* added faq module ([bf2a881](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/bf2a881df6138434d52cd678fdf368db2d69eedf))
|
|
33
|
+
* added width and height with image module ([f057ea9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f057ea963adaa33ec84aa937bbe4af984df9f16c))
|
|
34
|
+
* added width and height with image module ([a277de5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a277de55520599c1cac34e3934e69264fb976f3f))
|
|
35
|
+
* anchor minor styling issue ([68eda40](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/68eda40450ae5685be4f481f4cc17f48ae80017d))
|
|
36
|
+
* linked the game provider to the actual page ([7a878be](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7a878bee42bfd06229ae3ff199cd8a3c31ee1b57))
|
|
37
|
+
* removed module intro component and used the content module instead ([a37deeb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a37deeb398ae347dccf2af01ee2bde80e81fcb86))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
* Merge branch 'tm-3037-module-intro' into 'master' ([6fc0c6c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6fc0c6c0884522ed0eca6bd944924aedee69f5b5))
|
|
41
|
+
* Merge branch 'tm-2781-link-provider-link-pages' into 'master' ([f799ac5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f799ac5f78f9528f9d18e9e6b241d1729b0949e7))
|
|
42
|
+
* Merge branch 'tm-3038-anchor-progress-bar' into 'master' ([1e05599](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1e055990d3c6058897a6ac752a3999e1c3bb1960))
|
|
43
|
+
* Merge branch 'master' into 'tm-2781-link-provider-link-pages' ([1d55b26](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1d55b264ae377cc9d0a1ed6619067af7dca0e739))
|
|
44
|
+
|
|
1
45
|
## [11.0.3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v11.0.2...v11.0.3) (2022-08-24)
|
|
2
46
|
|
|
3
47
|
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
import { translate, imagePrettyUrl, getAltText } from '~helpers/getters';
|
|
10
10
|
import styles from './author-box.module.scss';
|
|
11
11
|
import LazyImage from '~hooks/lazy-image';
|
|
12
|
-
import
|
|
12
|
+
import Button from '~atoms/button';
|
|
13
13
|
import { Context } from '~context/TranslationsProvider';
|
|
14
14
|
|
|
15
15
|
export default function AuthorBox({ author, preElement = null }) {
|
|
@@ -94,13 +94,14 @@ export default function AuthorBox({ author, preElement = null }) {
|
|
|
94
94
|
/>
|
|
95
95
|
</div>
|
|
96
96
|
{author.profile_page_path && (
|
|
97
|
-
<
|
|
97
|
+
<Button
|
|
98
|
+
primaryColor={false}
|
|
98
99
|
to={author.profile_page_path}
|
|
99
|
-
|
|
100
|
+
btnText="Read More"
|
|
100
101
|
className={`${styles.button} author-gtm`}
|
|
101
102
|
>
|
|
102
103
|
{translate(translations, 'read_more', 'Read More')}
|
|
103
|
-
</
|
|
104
|
+
</Button>
|
|
104
105
|
)}
|
|
105
106
|
</div>
|
|
106
107
|
</div>
|
|
@@ -18,6 +18,7 @@ function Button({
|
|
|
18
18
|
disabled = false,
|
|
19
19
|
tertiary = false,
|
|
20
20
|
noStyle = false,
|
|
21
|
+
icon = null,
|
|
21
22
|
gtmClass = '',
|
|
22
23
|
}) {
|
|
23
24
|
const classes = `${styles.ctaBtn} ${primaryColor ? styles.primary : styles.secondary} ${
|
|
@@ -37,6 +38,7 @@ function Button({
|
|
|
37
38
|
disabled={disabled}
|
|
38
39
|
>
|
|
39
40
|
{btnText}
|
|
41
|
+
{icon && icon}
|
|
40
42
|
</button>
|
|
41
43
|
);
|
|
42
44
|
}
|
|
@@ -45,6 +47,7 @@ function Button({
|
|
|
45
47
|
return (
|
|
46
48
|
<Link className={`${classes} ${gtmClass}`} to={to} title={btnTitle} aria-label={btnTitle}>
|
|
47
49
|
{btnText}
|
|
50
|
+
{icon && icon}
|
|
48
51
|
</Link>
|
|
49
52
|
);
|
|
50
53
|
}
|
|
@@ -60,12 +63,14 @@ function Button({
|
|
|
60
63
|
rel="nofollow noreferrer"
|
|
61
64
|
>
|
|
62
65
|
{btnText}
|
|
66
|
+
{icon && icon}
|
|
63
67
|
</a>
|
|
64
68
|
);
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
Button.propTypes = {
|
|
68
72
|
to: PropTypes.string,
|
|
73
|
+
icon: PropTypes.func,
|
|
69
74
|
btnText: PropTypes.oneOfType([PropTypes.string, PropTypes.any]),
|
|
70
75
|
primaryColor: PropTypes.bool,
|
|
71
76
|
invertColors: PropTypes.bool,
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
.faqContainer {
|
|
2
|
+
padding: 0 1.6rem;
|
|
3
|
+
@include min(tablet) {
|
|
4
|
+
padding: 0 2.4rem;
|
|
5
|
+
}
|
|
6
|
+
.faqItem {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
padding: 1rem 1.6rem 1.6rem;
|
|
10
|
+
background-color: #fff;
|
|
11
|
+
border-radius: 0.6rem;
|
|
12
|
+
margin: 1rem 0;
|
|
13
|
+
|
|
14
|
+
.title {
|
|
15
|
+
position: relative;
|
|
16
|
+
text-align: left;
|
|
17
|
+
color: var(--color-12);
|
|
18
|
+
font-size: 1.8rem;
|
|
19
|
+
font-weight: 700;
|
|
20
|
+
padding: 1rem 0;
|
|
21
|
+
outline: none;
|
|
22
|
+
padding-right: 2.5rem;
|
|
23
|
+
.icon{
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
.circle{
|
|
27
|
+
@include flex-align (center, center);
|
|
28
|
+
margin-right: 0.5rem;
|
|
29
|
+
}
|
|
30
|
+
> span{
|
|
31
|
+
display: block;
|
|
32
|
+
margin: 0;
|
|
33
|
+
margin-right: 2rem;
|
|
34
|
+
font-weight: 700;
|
|
35
|
+
font-size: 1.8rem;
|
|
36
|
+
p, h2, h3, h4 {
|
|
37
|
+
margin: 0;
|
|
38
|
+
font-weight: 700;
|
|
39
|
+
font-size: 1.8rem;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
&:hover,
|
|
44
|
+
&:focus {
|
|
45
|
+
outline: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&:after {
|
|
49
|
+
transition: 0.5s;
|
|
50
|
+
@include arrow(black, 0.9rem, down, false, translateY(-50%));
|
|
51
|
+
position: absolute;
|
|
52
|
+
right: 0.5rem;
|
|
53
|
+
top: 50%;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&.invertArrow {
|
|
57
|
+
&:after {
|
|
58
|
+
transform: translateY(-50%) rotate(-135deg);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.content {
|
|
64
|
+
@include collapse(0.5s, 500rem);
|
|
65
|
+
@include flex-direction(column);
|
|
66
|
+
font-size: 1.6rem;
|
|
67
|
+
color: var(--color-20);
|
|
68
|
+
padding: 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import {
|
|
4
|
+
Title,
|
|
5
|
+
Description,
|
|
6
|
+
Primary,
|
|
7
|
+
PRIMARY_STORY,
|
|
8
|
+
ArgsTable,
|
|
9
|
+
} from '@storybook/addon-docs/blocks';
|
|
10
|
+
|
|
11
|
+
import Faq from '.';
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
title: 'Gatsby-Theme/Atoms/Faq',
|
|
15
|
+
component: Faq,
|
|
16
|
+
argTypes: {
|
|
17
|
+
module: {
|
|
18
|
+
name: 'module',
|
|
19
|
+
type: { name: 'object', required: true },
|
|
20
|
+
defaultValue: null,
|
|
21
|
+
description: 'The page object.',
|
|
22
|
+
},
|
|
23
|
+
openAll: {
|
|
24
|
+
name: 'openAll',
|
|
25
|
+
type: { name: 'boolean', required: false },
|
|
26
|
+
defaultValue: false,
|
|
27
|
+
description: 'This prop opens all sections',
|
|
28
|
+
},
|
|
29
|
+
openItem: {
|
|
30
|
+
name: 'OpenItem',
|
|
31
|
+
type: { name: 'boolean', required: true },
|
|
32
|
+
defaultValue: '',
|
|
33
|
+
description: 'This prop open a sections',
|
|
34
|
+
},
|
|
35
|
+
closeOthers: {
|
|
36
|
+
name: 'closeOthers',
|
|
37
|
+
type: { name: 'boolean', required: false },
|
|
38
|
+
defaultValue: false,
|
|
39
|
+
description: 'This prop close all others sections',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
parameters: {
|
|
43
|
+
docs: {
|
|
44
|
+
description: {
|
|
45
|
+
component:
|
|
46
|
+
'A component that gets an object of data and generates divs including keys/values. works as a slider on mobile devices',
|
|
47
|
+
},
|
|
48
|
+
page: () => (
|
|
49
|
+
<>
|
|
50
|
+
<Title />
|
|
51
|
+
<Description />
|
|
52
|
+
<Primary />
|
|
53
|
+
<ArgsTable story={PRIMARY_STORY} />
|
|
54
|
+
</>
|
|
55
|
+
),
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const Template = (args) => <Faq {...args} />;
|
|
61
|
+
|
|
62
|
+
export const Default = Template.bind({});
|
|
63
|
+
Default.args = {
|
|
64
|
+
module: {
|
|
65
|
+
items: [
|
|
66
|
+
{
|
|
67
|
+
question: '🍀 Do online casinos need an Irish gambling licence?',
|
|
68
|
+
answer:
|
|
69
|
+
'Yes. In 2015 there was an amendment to the Irish Gambling Law to legally be able to provide gambling services to Irish players, the online casino needs a licence. When you play online it is important to do some research before you choose a casino, so that you are sure you choose a good and licensed and regulated one.',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
question: '🍀 Is it legal to gamble in Ireland?',
|
|
73
|
+
answer: 'Yes, it is legal provided the online casino has the correct license.',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
question: '🍀 How safe are Irish online casinos?',
|
|
77
|
+
answer:
|
|
78
|
+
'Online casinos are very safe to use if you do your research. Good online casinos will offer only secure payment options, as well as having additional encryption protocols in place. This is to prevent third parties from getting both your money and your personal data. We always provide information on whether an Irish casino has this or not. ',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
question: '🍀 Can I play at Irish Luck from another country?',
|
|
82
|
+
answer:
|
|
83
|
+
'Unfortunately, no. The casino lists and reviews at Irish Luck are aimed for Irish players. Therefore, if you are visiting our website from another country, we suggest that you check out other sites that are localised for your country.',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
question: '🍀 What`s the best online casinos for Irish Players?',
|
|
87
|
+
answer:
|
|
88
|
+
'That`s a good question! And that`s also why it`s not the easiest to answer. It depends on what you prefer and what is important to you when you, when have to choose a gambling site. We recommend that you have a look at the toplist on top of this page. It`s always updated with the best casinos right now! Then go from there and see which one speaks the most to you. Good luck!',
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/* eslint-disable no-return-assign */
|
|
2
|
+
import React, { useRef, useEffect } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import styles from './faq.module.scss';
|
|
6
|
+
import keygen from '~helpers/keygen';
|
|
7
|
+
|
|
8
|
+
/* eslint-disable react/no-danger */
|
|
9
|
+
|
|
10
|
+
const Faq = ({ module, closeAll = false, openItem, closeOthers = false, icon = '' }) => {
|
|
11
|
+
const { items } = module;
|
|
12
|
+
const itemRefs = useRef([]);
|
|
13
|
+
const btnRefs = useRef([]);
|
|
14
|
+
|
|
15
|
+
const closeAllItems = () => {
|
|
16
|
+
for (let i = 0; i < itemRefs.current.length; i += 1) {
|
|
17
|
+
itemRefs.current[i].classList.remove(styles.active);
|
|
18
|
+
btnRefs.current[i].classList.remove(styles.invertArrow);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const openSingleItem = (index) => {
|
|
23
|
+
if (itemRefs.current[index]) {
|
|
24
|
+
itemRefs.current[index].classList.add(styles.active);
|
|
25
|
+
btnRefs.current[index].classList.add(styles.invertArrow);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const closeOtherItems = (index) => {
|
|
30
|
+
for (let i = 0; i < itemRefs.current.length; i += 1) {
|
|
31
|
+
if (i !== index) {
|
|
32
|
+
itemRefs.current[i].classList.remove(styles.active);
|
|
33
|
+
btnRefs.current[i].classList.remove(styles.invertArrow);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// toggle open/close an item
|
|
39
|
+
const toggle = (index) => {
|
|
40
|
+
btnRefs.current[index].classList.toggle(styles.invertArrow);
|
|
41
|
+
itemRefs.current[index].classList.toggle(styles.active);
|
|
42
|
+
if (closeOthers) {
|
|
43
|
+
closeOtherItems(index);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (closeAll) {
|
|
49
|
+
closeAllItems();
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (openItem) {
|
|
54
|
+
openSingleItem(openItem - 1);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<>
|
|
60
|
+
<div className={styles.faqContainer}>
|
|
61
|
+
{items.map((item, index) => (
|
|
62
|
+
<div key={keygen()} className={styles.faqItem}>
|
|
63
|
+
<button
|
|
64
|
+
onClick={() => toggle(index)}
|
|
65
|
+
className={`${styles.title} faq-gtm`}
|
|
66
|
+
type="button"
|
|
67
|
+
ref={(el) => (btnRefs.current[index] = el)}
|
|
68
|
+
>
|
|
69
|
+
<span className={styles.icon}>
|
|
70
|
+
{icon && <span className={styles.circle}>{icon} </span>}
|
|
71
|
+
<span dangerouslySetInnerHTML={{ __html: item.question }} />
|
|
72
|
+
</span>
|
|
73
|
+
</button>
|
|
74
|
+
<div
|
|
75
|
+
className={`${styles.content} ${styles.active}`}
|
|
76
|
+
ref={(el) => (itemRefs.current[index] = el)}
|
|
77
|
+
dangerouslySetInnerHTML={{ __html: item.answer }}
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
))}
|
|
81
|
+
</div>
|
|
82
|
+
</>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
Faq.propTypes = {
|
|
87
|
+
module: PropTypes.shape({
|
|
88
|
+
anchor_label: PropTypes.string,
|
|
89
|
+
items: PropTypes.arrayOf(
|
|
90
|
+
PropTypes.shape({
|
|
91
|
+
title: PropTypes.string,
|
|
92
|
+
content: PropTypes.string,
|
|
93
|
+
})
|
|
94
|
+
),
|
|
95
|
+
}).isRequired,
|
|
96
|
+
closeAll: PropTypes.bool,
|
|
97
|
+
openItem: PropTypes.number,
|
|
98
|
+
closeOthers: PropTypes.bool,
|
|
99
|
+
styles: PropTypes.shape({}),
|
|
100
|
+
icon: PropTypes.func,
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export default Faq;
|
|
@@ -11,12 +11,14 @@ const Image = ({ module = {} }) => {
|
|
|
11
11
|
if (!value) return <></>;
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
<LazyImage
|
|
15
|
+
src={imagePrettyUrl(value, 912, 333)}
|
|
16
|
+
alt={alt || 'missing alt'}
|
|
17
|
+
width={912}
|
|
18
|
+
height={333}
|
|
19
|
+
title={title && title}
|
|
20
|
+
className={`${styles.imageModule} ${styles[alignment]}`}
|
|
21
|
+
/>
|
|
20
22
|
);
|
|
21
23
|
};
|
|
22
24
|
|
|
@@ -87,7 +87,7 @@ Header.propTypes = {
|
|
|
87
87
|
path: PropTypes.string,
|
|
88
88
|
updated_at: PropTypes.string,
|
|
89
89
|
created_at: PropTypes.string,
|
|
90
|
-
reading_time: PropTypes.
|
|
90
|
+
reading_time: PropTypes.number,
|
|
91
91
|
reviewer: PropTypes.string,
|
|
92
92
|
reviewer_id: PropTypes.number,
|
|
93
93
|
author: PropTypes.shape({
|
|
@@ -28,6 +28,8 @@ const Modules = ({ module, page, pageContext }) => {
|
|
|
28
28
|
return loadable(() => import('~organisms/cards'));
|
|
29
29
|
case 'pros_and_cons':
|
|
30
30
|
return loadable(() => import('~molecules/pros-cons'));
|
|
31
|
+
case 'faq':
|
|
32
|
+
return loadable(() => import('~atoms/faq'));
|
|
31
33
|
case 'accordion':
|
|
32
34
|
return loadable(() => import('~organisms/accordion'));
|
|
33
35
|
case 'anchor':
|
|
@@ -72,8 +74,7 @@ const Modules = ({ module, page, pageContext }) => {
|
|
|
72
74
|
'--module-background-color': module.background_color,
|
|
73
75
|
};
|
|
74
76
|
|
|
75
|
-
const ModuleIntro =
|
|
76
|
-
module.module_introduction && loadable(() => import('~molecules/content-intro'));
|
|
77
|
+
const ModuleIntro = module.module_introduction && loadable(() => import('~molecules/content'));
|
|
77
78
|
|
|
78
79
|
return (
|
|
79
80
|
ModuleComponent && (
|
|
@@ -85,7 +86,7 @@ const Modules = ({ module, page, pageContext }) => {
|
|
|
85
86
|
} ${styles.module} ${module?.style && styles[module.style]} module`}
|
|
86
87
|
>
|
|
87
88
|
<ModuleTitle module={module} />
|
|
88
|
-
{ModuleIntro && <ModuleIntro
|
|
89
|
+
{ModuleIntro && <ModuleIntro module={{ value: module.module_introduction }} />}
|
|
89
90
|
<ModuleComponent module={module} page={page} pageContext={pageContext} {...extraProps} />
|
|
90
91
|
</div>
|
|
91
92
|
)
|
|
@@ -8,8 +8,14 @@
|
|
|
8
8
|
box-shadow: 0px 8px 12px 0px;
|
|
9
9
|
left: 0;
|
|
10
10
|
right: 0;
|
|
11
|
-
|
|
11
|
+
.progressBar{
|
|
12
|
+
height: 5px;
|
|
13
|
+
width: 100px;
|
|
14
|
+
background-color: var(--progress-bar-color, red);
|
|
15
|
+
transition: width 1s;
|
|
16
|
+
}
|
|
12
17
|
}
|
|
18
|
+
|
|
13
19
|
|
|
14
20
|
.defaultConatiner {
|
|
15
21
|
position: relative;
|
|
@@ -30,12 +36,13 @@
|
|
|
30
36
|
@include flex-direction(row);
|
|
31
37
|
&::-webkit-scrollbar {
|
|
32
38
|
height: 0.5rem;
|
|
39
|
+
display: none;
|
|
33
40
|
}
|
|
34
41
|
&::-webkit-scrollbar-track {
|
|
35
42
|
background: #fff;
|
|
36
43
|
}
|
|
37
44
|
&::-webkit-scrollbar-thumb {
|
|
38
|
-
background:
|
|
45
|
+
background: black;
|
|
39
46
|
}
|
|
40
47
|
overflow-x: scroll;
|
|
41
48
|
.link {
|
|
@@ -24,6 +24,7 @@ function Anchor({
|
|
|
24
24
|
const itemsRef = useRef([]);
|
|
25
25
|
const anchorContainerRef = useRef(null);
|
|
26
26
|
const anchorListRef = useRef(null);
|
|
27
|
+
const progressBar = useRef(null);
|
|
27
28
|
const sticky = isFixed && isSticky(offsetTop);
|
|
28
29
|
const { translations } = useContext(Context) || {};
|
|
29
30
|
const anchorList = items.map((anchor) => ({
|
|
@@ -52,11 +53,17 @@ function Anchor({
|
|
|
52
53
|
|
|
53
54
|
const setActiveAnchor = () => {
|
|
54
55
|
anchorContainerRef.current && setOffsetTop(anchorContainerRef.current.offsetTop);
|
|
56
|
+
const { innerHeight, scrollY } = window;
|
|
57
|
+
|
|
58
|
+
// progress scroll bar
|
|
59
|
+
const scrollHeight = document.querySelector('body').scrollHeight;
|
|
60
|
+
const calcPercent = (scrollY * 100) / (scrollHeight - innerHeight);
|
|
61
|
+
progressBar.current ? (progressBar.current.style.width = `${calcPercent}%`) : null;
|
|
55
62
|
|
|
56
63
|
// get element in viewport
|
|
57
64
|
const currentAnchor = anchorList?.map((el) => {
|
|
58
65
|
const element = document.getElementById(el.id);
|
|
59
|
-
if (element?.offsetTop - headerOffset - heightOfAnchor - offset <=
|
|
66
|
+
if (element?.offsetTop - headerOffset - heightOfAnchor - offset <= scrollY) {
|
|
60
67
|
return element;
|
|
61
68
|
}
|
|
62
69
|
return null;
|
|
@@ -133,6 +140,7 @@ function Anchor({
|
|
|
133
140
|
</li>
|
|
134
141
|
))}
|
|
135
142
|
</ul>
|
|
143
|
+
{sticky && <div ref={progressBar} className={styles.progressBar} />}
|
|
136
144
|
</div>
|
|
137
145
|
</div>
|
|
138
146
|
);
|
package/src/helpers/getters.js
CHANGED
|
@@ -374,6 +374,16 @@ export function shiftFirstOperator(pageId, module, pagesMappedById) {
|
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
+
export const getModuleTitle = (module, page) => {
|
|
378
|
+
if (page && page.type === 'operator') {
|
|
379
|
+
return (
|
|
380
|
+
module.module_title && module.module_title.replace('[operator_name]', page.relation.name)
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
return module.title;
|
|
385
|
+
};
|
|
386
|
+
|
|
377
387
|
export const getRoundMinutes = (time) => {
|
|
378
388
|
const [minutes, seconds] = time.split(':');
|
|
379
389
|
const value = seconds > 30 ? Number(minutes) + 1 : Number(minutes);
|
|
@@ -29,6 +29,15 @@ describe('Getters Helper', () => {
|
|
|
29
29
|
expect(Getters.getExtraField({ name: 'foo' }, 'name', 'def')).toEqual('foo');
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
+
test('getModuleTitle()', () => {
|
|
33
|
+
expect(
|
|
34
|
+
Getters.getModuleTitle(
|
|
35
|
+
{ module_title: 'Test [operator_name] test' },
|
|
36
|
+
{ type: 'operator', relation: { name: 'test name' } }
|
|
37
|
+
)
|
|
38
|
+
).toEqual('Test test name test');
|
|
39
|
+
});
|
|
40
|
+
|
|
32
41
|
test('getSection()', () => {
|
|
33
42
|
expect(Getters.getSection('short_code', { page: {}, marketSections: {} })).toBeNull();
|
|
34
43
|
expect(
|
|
@@ -256,6 +256,19 @@ export default {
|
|
|
256
256
|
) {
|
|
257
257
|
transformedPages[market][pageType][index].relation =
|
|
258
258
|
relations[page.type][page.relation_id] || null;
|
|
259
|
+
|
|
260
|
+
// Linking game provider path to the game
|
|
261
|
+
if (page.type === 'game') {
|
|
262
|
+
const providerId =
|
|
263
|
+
transformedPages[market][pageType][index].relation.game_provider.id;
|
|
264
|
+
const providerPage = transformedPages[market].software_provider
|
|
265
|
+
? transformedPages[market].software_provider.filter(
|
|
266
|
+
(provider) => providerId === provider.relation_id
|
|
267
|
+
)
|
|
268
|
+
: [];
|
|
269
|
+
transformedPages[market][pageType][index].relation.game_provider.path =
|
|
270
|
+
providerPage.length > 0 ? providerPage[0].path : null;
|
|
271
|
+
}
|
|
259
272
|
}
|
|
260
273
|
|
|
261
274
|
// add author object to page
|
|
@@ -5,7 +5,7 @@ import { clonePageForCards, groupBy, removeDuplicates } from './common';
|
|
|
5
5
|
import settings from '../../constants/settings';
|
|
6
6
|
import ModuleValue from '../../constants/module-value';
|
|
7
7
|
import { topListPickKeys } from '../../constants/pick-keys';
|
|
8
|
-
import { shiftFirstOperator } from '../getters';
|
|
8
|
+
import { shiftFirstOperator, getModuleTitle } from '../getters';
|
|
9
9
|
import { generatePlaceholderString } from '../generators';
|
|
10
10
|
|
|
11
11
|
const pagesGroupedByTemplateId = [];
|
|
@@ -223,6 +223,11 @@ export function processCardsV2(module, pagesCloned, pagesMappedById, pageId) {
|
|
|
223
223
|
shiftFirstOperator(pageId, module, pagesMappedById);
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
// Check for module title placeholders
|
|
227
|
+
if (pageId !== null) {
|
|
228
|
+
module.module_title = getModuleTitle(module, pagesMappedById[pageId]);
|
|
229
|
+
}
|
|
230
|
+
|
|
226
231
|
// modify page so it doesn't have too much data
|
|
227
232
|
module.items = module.items.map((item) => clonePageForCards(cloneDeep(item), module.style));
|
|
228
233
|
}
|
package/src/hooks/link/index.js
CHANGED
|
@@ -50,7 +50,7 @@ function LinkCustom({
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
LinkCustom.propTypes = {
|
|
53
|
-
to: PropTypes.string
|
|
53
|
+
to: PropTypes.string,
|
|
54
54
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.element, PropTypes.any]),
|
|
55
55
|
activeClassName: PropTypes.string,
|
|
56
56
|
partiallyActive: PropTypes.bool,
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, cleanup } from '@testing-library/react';
|
|
3
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
4
|
-
|
|
5
|
-
import { getSingleContentData } from '~tests/factories/modules/content.factory';
|
|
6
|
-
import ContentIntro from '.';
|
|
7
|
-
|
|
8
|
-
describe('Content Component', () => {
|
|
9
|
-
test('render content props', () => {
|
|
10
|
-
const correctData = getSingleContentData('h4');
|
|
11
|
-
const { container } = render(<ContentIntro content={correctData.value} />);
|
|
12
|
-
expect(container).toBeTruthy();
|
|
13
|
-
// getByText(container, 'Goodbye world')
|
|
14
|
-
// HTML parse
|
|
15
|
-
expect(container.querySelectorAll('p')).toHaveLength(1);
|
|
16
|
-
expect(container.querySelectorAll('i')).toHaveLength(1);
|
|
17
|
-
|
|
18
|
-
// Lazy image
|
|
19
|
-
expect(container.querySelectorAll('div.lazyload-wrapper')).toHaveLength(1);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
afterEach(() => {
|
|
24
|
-
cleanup();
|
|
25
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import loadable from '@loadable/component';
|
|
3
|
-
import parse from 'html-react-parser';
|
|
4
|
-
import LazyImage from '~hooks/lazy-image';
|
|
5
|
-
import { parseCss } from '~helpers/css-parser';
|
|
6
|
-
import { parseContentImageUrl } from '~helpers/strings';
|
|
7
|
-
|
|
8
|
-
import styles from './content-intro.module.scss';
|
|
9
|
-
|
|
10
|
-
export default function index({ content }) {
|
|
11
|
-
const replaceMedia = (node) => {
|
|
12
|
-
if (node.name === 'iframe') {
|
|
13
|
-
const Iframe = loadable(() => import('gatsby-core-theme/src/components/atoms/iframe'));
|
|
14
|
-
return <Iframe src={node.attribs.src} />;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (node.name === 'img') {
|
|
18
|
-
const lazyProps = {
|
|
19
|
-
src: parseContentImageUrl(node.attribs.src),
|
|
20
|
-
width: node.attribs.width && node.attribs.width.replace('px', ''),
|
|
21
|
-
height: node.attribs.height && node.attribs.height.replace('px', ''),
|
|
22
|
-
style: node.attribs.style ? parseCss(node.attribs.style) : null,
|
|
23
|
-
alt: node.attribs.alt ? node.attribs.alt : 'missing alt',
|
|
24
|
-
};
|
|
25
|
-
return <LazyImage {...lazyProps} />;
|
|
26
|
-
}
|
|
27
|
-
return null;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<div className={styles.contentIntro}>
|
|
32
|
-
{parse(content, {
|
|
33
|
-
replace: replaceMedia,
|
|
34
|
-
})}
|
|
35
|
-
</div>
|
|
36
|
-
);
|
|
37
|
-
}
|