gatsby-core-theme 35.1.2 → 35.1.4
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 +34 -0
- package/package.json +1 -1
- package/src/components/atoms/button/operator-cta.js +7 -7
- package/src/components/atoms/menu/mega-items/index.js +1 -1
- package/src/components/atoms/menu/mega-items/mega-item.module.scss +43 -54
- package/src/components/atoms/menu/variables/index.js +7 -15
- package/src/components/atoms/menu/variables/variable.module.scss +3 -0
- package/src/components/atoms/notifications/index.js +80 -0
- package/src/components/atoms/notifications/market-dropdown.stories.js +114 -0
- package/src/components/atoms/notifications/notification-items/index.js +111 -0
- package/src/components/atoms/notifications/notification-items/notification-items.module.scss +271 -0
- package/src/components/atoms/notifications/notifications.module.scss +24 -0
- package/src/components/atoms/notifications/notifications.test.js +95 -0
- package/src/components/atoms/ratings/index.js +1 -1
- package/src/components/atoms/ratings/ratings.module.scss +6 -9
- package/src/components/molecules/menu/index.js +18 -13
- package/src/components/molecules/newsletter/index.js +3 -2
- package/src/components/molecules/toplist/header/index.js +4 -1
- package/src/components/organisms/navigation/index.js +9 -1
- package/src/components/organisms/navigation/navigation.stories.js +76 -3
- package/src/constants/pick-keys.mjs +2 -1
- package/src/constants/site-settings/navigation.js +2 -1
- package/src/helpers/processor/index.mjs +7 -5
- package/static/images/close.svg +3 -0
- package/static/images/markets/ar_es copy.svg +13 -0
- package/static/images/markets/arab_ar.svg +17 -0
- package/static/images/markets/bo_es.svg +5 -0
- package/static/images/markets/cl_es.svg +13 -0
- package/static/images/markets/co_es.svg +7 -0
- package/static/images/markets/cr_es.svg +10 -0
- package/static/images/markets/dk_en.svg +24 -0
- package/static/images/markets/ec_es.svg +10 -0
- package/static/images/markets/gt_es.svg +11 -0
- package/static/images/markets/hn_es.svg +14 -0
- package/static/images/markets/mx_es.svg +11 -0
- package/static/images/markets/pe_es.svg +9 -0
- package/static/images/markets/sv_es.svg +12 -0
- package/static/images/markets/ve_es.svg +17 -0
- package/tests/factories/modules/toplist.factory.js +88 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
## [35.1.4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v35.1.3...v35.1.4) (2024-08-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* added check for empty toplist ([897ec1e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/897ec1e2a45300e0a2075df88dd2d5e781772e0e))
|
|
7
|
+
* fix multiple contributor author reviews ([6cedeb2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6cedeb2b0b0344d102a0c55e74f2b0dd8ee37c31))
|
|
8
|
+
* seperated notification bell from variable component ([3c45d81](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3c45d81867b0b485b5acd5eb2298144723529a83))
|
|
9
|
+
* tests ([d1827fe](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d1827fe29e9cd595e2994867a69d9c3e758cf89d))
|
|
10
|
+
* updated storybook + added notification component ([44f36e9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/44f36e90b61e0574661acf15d9fdb7abc4d43602))
|
|
11
|
+
* updated storybook + added notification component ([8005ba6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8005ba6b106af7b95bc78ed4dafa50f4c354fe1d))
|
|
12
|
+
* updated storybook iamges for toplists ([0fdf491](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0fdf4914191436ff3daa2c1ee0af1eaf83dc6051))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
* Merge branch 'tm-4654-multiple-contributors' into 'master' ([1f77002](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1f77002a79aa6dc421190234429274331ae5e274))
|
|
16
|
+
* Merge branch 'tm-4631-notifications' into 'master' ([4b99dfc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4b99dfc3edc091a3f0409d22c19590f2ba3d9c6f))
|
|
17
|
+
* Merge branch 'master' into tm-4631-notifications ([87e75a4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/87e75a46a43b0082a1819585eeb9861f7abde4a8))
|
|
18
|
+
|
|
19
|
+
## [35.1.3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v35.1.2...v35.1.3) (2024-08-06)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* add payout time ([7c0ba73](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7c0ba733207e119e9be70e1b2aa4a2b07e662e19))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Code Refactoring
|
|
28
|
+
|
|
29
|
+
* add style ([3c5b7e5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3c5b7e54fba0fd69a2142556f64322b835a0b057))
|
|
30
|
+
* change to ratings rtp value if 0 ([8b8eb92](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8b8eb92a51419c4c94206351dadb91bc75b0e5e2))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
* Merge branch 'tm-4666-ratings' into 'master' ([0362956](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0362956a9d525ffd394ac8b77832ec39dd40bc9f))
|
|
34
|
+
|
|
1
35
|
## [35.1.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v35.1.1...v35.1.2) (2024-08-05)
|
|
2
36
|
|
|
3
37
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable react/jsx-no-target-blank */
|
|
2
2
|
/* eslint-disable no-unused-expressions */
|
|
3
|
-
import React
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { globalHistory } from '@reach/router';
|
|
6
6
|
import useTranslate from '~hooks/useTranslate/useTranslate';
|
|
@@ -33,14 +33,14 @@ const OperatorCtaButton = ({
|
|
|
33
33
|
const trackerType = tracker?.toLowerCase()?.replace(' ', '_');
|
|
34
34
|
const referer = typeof document !== 'undefined' && document?.referrer ? document.referrer : '';
|
|
35
35
|
const prettyLink = `${prettyTracker(operator, trackerType, false, pageTemplate)}`;
|
|
36
|
-
|
|
36
|
+
const translateBtnTxt = useTranslate(
|
|
37
|
+
translationsObj[status]?.translationKey,
|
|
38
|
+
translationsObj[status]?.defaultValue || ''
|
|
39
|
+
);
|
|
37
40
|
const translateBtn =
|
|
38
41
|
status && translationsObj[status]
|
|
39
|
-
?
|
|
40
|
-
|
|
41
|
-
translationsObj[status]?.defaultValue || ''
|
|
42
|
-
)
|
|
43
|
-
: '';
|
|
42
|
+
? translateBtnTxt
|
|
43
|
+
: 'Claim';
|
|
44
44
|
|
|
45
45
|
const onCTAClick = () => {
|
|
46
46
|
process.env.IS_TRACKING_SSR &&
|
|
@@ -23,9 +23,13 @@
|
|
|
23
23
|
|
|
24
24
|
@include min(desktop) {
|
|
25
25
|
margin: 0 auto;
|
|
26
|
+
|
|
26
27
|
@include flex-align(center, space-between);
|
|
28
|
+
|
|
27
29
|
height: 35rem;
|
|
28
30
|
}
|
|
31
|
+
|
|
32
|
+
background-color: transparent;
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
.megaItems {
|
|
@@ -63,6 +67,8 @@
|
|
|
63
67
|
|
|
64
68
|
@include min(desktop) {
|
|
65
69
|
background-color: var(--levelTwo-bg-color, var(--nav-background-color));
|
|
70
|
+
backdrop-filter: blur(50px);
|
|
71
|
+
opacity: .5;
|
|
66
72
|
position: absolute;
|
|
67
73
|
top: calc(100% + 1px);
|
|
68
74
|
right: 0;
|
|
@@ -70,8 +76,8 @@
|
|
|
70
76
|
perspective: 1000px;
|
|
71
77
|
z-index: -1;
|
|
72
78
|
transform-origin: top center;
|
|
73
|
-
animation:
|
|
74
|
-
border-top:
|
|
79
|
+
animation: rotate-x 900ms 200ms ease-in-out forwards;
|
|
80
|
+
border-top: 0;
|
|
75
81
|
|
|
76
82
|
&.show {
|
|
77
83
|
display: none;
|
|
@@ -82,42 +88,15 @@
|
|
|
82
88
|
.level1 {
|
|
83
89
|
@include flex-direction(column);
|
|
84
90
|
@include flex-align(stretch, center);
|
|
91
|
+
|
|
85
92
|
background-color: var(--levelOne-btn-bg-color, var(--levelOne-bg-color));
|
|
86
93
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
&:after {
|
|
90
|
-
transition: 0.2s;
|
|
91
|
-
@include arrow(var(--menu-text-color), 0.7rem, down, false);
|
|
92
|
-
position: absolute;
|
|
93
|
-
top: 2.4rem;
|
|
94
|
-
right: 2.6rem;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
> a,
|
|
99
|
-
> span {
|
|
100
|
-
color: var(--levelOne-text-color, var(--menu-text-color));
|
|
101
|
-
background-color: var(--levelOne-bg-color, var(--nav-background-color));
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@include min(desktop) {
|
|
105
|
-
border: none;
|
|
94
|
+
@include min(tablet) {
|
|
95
|
+
border: 0;
|
|
106
96
|
border-top: 3px solid transparent;
|
|
107
97
|
border-bottom: 3px solid transparent;
|
|
108
98
|
background-color: var(--levelOne-desktop-bg-color, var(--levelOne-bg-color));
|
|
109
|
-
|
|
110
|
-
&.hasChildren {
|
|
111
|
-
&:hover {
|
|
112
|
-
@include arrow-rotate(0);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
&:after {
|
|
116
|
-
top: calc(50% - 0.3rem);
|
|
117
|
-
right: 2.2rem;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
99
|
+
|
|
121
100
|
&:hover {
|
|
122
101
|
background-color: var(--levelOne-hover-bg-color, var(--nav-background-color));
|
|
123
102
|
|
|
@@ -127,9 +106,14 @@
|
|
|
127
106
|
background-color: var(--levelOne-hover-bg-color, var(--nav-background-color));
|
|
128
107
|
}
|
|
129
108
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
> a,
|
|
112
|
+
> span {
|
|
113
|
+
color: var(--levelOne-text-color, var(--menu-text-color));
|
|
114
|
+
background-color: var(--levelOne-bg-color, var(--nav-background-color));
|
|
115
|
+
|
|
116
|
+
@include min(desktop) {
|
|
133
117
|
background-color: var(--levelOne-desktop-bg-color, var(--nav-background-color));
|
|
134
118
|
}
|
|
135
119
|
}
|
|
@@ -138,16 +122,6 @@
|
|
|
138
122
|
.level2 {
|
|
139
123
|
background-color: var(--levelTwo-btn-bg-color, var(--levelTwo-bg-color));
|
|
140
124
|
|
|
141
|
-
&.hasChildren {
|
|
142
|
-
&:after {
|
|
143
|
-
transition: 0.2s;
|
|
144
|
-
@include arrow(var(--menu-text-color), 0.7rem, right, false);
|
|
145
|
-
position: absolute;
|
|
146
|
-
top: 2.4rem;
|
|
147
|
-
right: 2.6rem;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
125
|
> a,
|
|
152
126
|
> span {
|
|
153
127
|
background-color: var(--levelTwo-bg-color, var(--nav-background-color));
|
|
@@ -157,13 +131,6 @@
|
|
|
157
131
|
@include min(desktop) {
|
|
158
132
|
background-color: var(--levelTwo-desktop-bg-color, var(--levelTwo-bg-color));
|
|
159
133
|
|
|
160
|
-
&.hasChildren {
|
|
161
|
-
&:after {
|
|
162
|
-
top: calc(50% - 0.3rem);
|
|
163
|
-
right: 2.4rem;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
134
|
> a,
|
|
168
135
|
> span {
|
|
169
136
|
background-color: var(--levelTwo-desktop-bg-color, var(--levelTwo-bg-color));
|
|
@@ -181,14 +148,36 @@
|
|
|
181
148
|
}
|
|
182
149
|
}
|
|
183
150
|
|
|
184
|
-
|
|
151
|
+
.hasChildren {
|
|
152
|
+
> a, > span {
|
|
153
|
+
position: relative;
|
|
154
|
+
|
|
155
|
+
&:hover {
|
|
156
|
+
@include arrow-rotate(0);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&::after {
|
|
160
|
+
transition: 0.2s;
|
|
161
|
+
|
|
162
|
+
@include arrow(var(--menu-text-color), 0.7rem, down, false);
|
|
163
|
+
|
|
164
|
+
position: absolute;
|
|
165
|
+
top: 2.4rem;
|
|
166
|
+
right: 2.6rem;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
@keyframes rotate-x {
|
|
185
172
|
0% {
|
|
186
173
|
opacity: 0;
|
|
187
174
|
transform: rotateX(-90deg);
|
|
188
175
|
}
|
|
176
|
+
|
|
189
177
|
50% {
|
|
190
178
|
transform: rotateX(-20deg);
|
|
191
179
|
}
|
|
180
|
+
|
|
192
181
|
100% {
|
|
193
182
|
opacity: 1;
|
|
194
183
|
transform: rotateX(0deg);
|
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import LazyImage from '~hooks/lazy-image';
|
|
4
3
|
import styles from './variable.module.scss';
|
|
5
|
-
import
|
|
6
|
-
import Bell from '../../../../../static/images/bell.svg';
|
|
4
|
+
import Newsletter from '../../../molecules/newsletter';
|
|
7
5
|
|
|
8
|
-
const VariableComponent = ({ pageContext
|
|
9
|
-
<div className={styles?.variableContainer || ''}>
|
|
10
|
-
<
|
|
11
|
-
alt="Notification bubble"
|
|
12
|
-
width={16}
|
|
13
|
-
height={16}
|
|
14
|
-
src={NotificationBubble}
|
|
15
|
-
disableLazyLoad
|
|
16
|
-
/>
|
|
17
|
-
<LazyImage alt="Notification bell" width={24} height={24} src={Bell} disableLazyLoad />
|
|
6
|
+
const VariableComponent = ({ pageContext }) => (
|
|
7
|
+
<div className={styles?.variableContainer || ''} >
|
|
8
|
+
<Newsletter page={pageContext?.page} openBtnText="Toggle Newsletter" footer={false} isSticky />
|
|
18
9
|
</div>
|
|
19
10
|
);
|
|
20
11
|
VariableComponent.propTypes = {
|
|
21
|
-
pageContext: PropTypes.shape({
|
|
22
|
-
|
|
12
|
+
pageContext: PropTypes.shape({
|
|
13
|
+
page: PropTypes.shape({})
|
|
14
|
+
}),
|
|
23
15
|
};
|
|
24
16
|
|
|
25
17
|
export default VariableComponent;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React, { useState, useContext, useEffect, useRef } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
|
|
4
|
+
import { toggleScroll } from 'gatsby-core-theme/src/helpers/scroll';
|
|
5
|
+
import { NavigationContext } from 'gatsby-core-theme/src/components/organisms/navigation/navigationContext';
|
|
6
|
+
import NotificationItems from './notification-items';
|
|
7
|
+
import styles from './notifications.module.scss';
|
|
8
|
+
|
|
9
|
+
const Notifications = ({ section }) => {
|
|
10
|
+
const { setShowSearch, setShowMenu, showMenu, showSearch } = useContext(NavigationContext);
|
|
11
|
+
const notificationRef = useRef(null);
|
|
12
|
+
const [newNotification, setNewNotification] = useState(true);
|
|
13
|
+
const [openNotification, setOpenNotification] = useState(false);
|
|
14
|
+
|
|
15
|
+
const { modules } = section || {};
|
|
16
|
+
const getNotifications = () => modules?.find((module) => module?.name === 'spotlights') || {};
|
|
17
|
+
|
|
18
|
+
const notificationActions = () => {
|
|
19
|
+
setNewNotification(false);
|
|
20
|
+
setOpenNotification(!openNotification);
|
|
21
|
+
|
|
22
|
+
if (showSearch) {
|
|
23
|
+
toggleScroll('search');
|
|
24
|
+
setShowSearch(!showSearch);
|
|
25
|
+
}
|
|
26
|
+
if (showMenu) {
|
|
27
|
+
toggleScroll('menu');
|
|
28
|
+
setShowMenu(!showMenu);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
function handleClickOutside(event) {
|
|
35
|
+
if (notificationRef.current && !notificationRef.current.contains(event.target)) {
|
|
36
|
+
setOpenNotification(false);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Bind the event listener
|
|
41
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
42
|
+
|
|
43
|
+
return () => {
|
|
44
|
+
// Unbind the event listener on clean up
|
|
45
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
46
|
+
};
|
|
47
|
+
}, [notificationRef]);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div ref={notificationRef} className={styles?.notificationOuter || ''}>
|
|
51
|
+
<div
|
|
52
|
+
className={`${styles.notificationIcon || ''} ${
|
|
53
|
+
newNotification ? styles.newNotification || '' : ''
|
|
54
|
+
} notification-bell-gtm`}
|
|
55
|
+
onKeyDown={() => notificationActions()}
|
|
56
|
+
onClick={() => notificationActions()}
|
|
57
|
+
role="button"
|
|
58
|
+
aria-label="Notification Bell Icon"
|
|
59
|
+
tabIndex={0}
|
|
60
|
+
>
|
|
61
|
+
<LazyImage
|
|
62
|
+
alt="Notification Bell"
|
|
63
|
+
width={26}
|
|
64
|
+
height={26}
|
|
65
|
+
src="/images/bell.svg"
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
{openNotification && (
|
|
69
|
+
<NotificationItems module={getNotifications()} onClose={() => notificationActions()} />
|
|
70
|
+
)}
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
Notifications.propTypes = {
|
|
76
|
+
pageContext: PropTypes.shape({}),
|
|
77
|
+
section: PropTypes.shape({}),
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export default Notifications;
|
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
|
|
11
|
+
import Notifications from ".";
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
title: "Theme/Layout/Navigation/Notifications",
|
|
15
|
+
component: Notifications,
|
|
16
|
+
argTypes: {
|
|
17
|
+
section: {
|
|
18
|
+
name: "section",
|
|
19
|
+
type: { name: "object", required: true },
|
|
20
|
+
defaultValue: "",
|
|
21
|
+
description: "The section object for the current page.",
|
|
22
|
+
table: {
|
|
23
|
+
type: { summary: "string" },
|
|
24
|
+
defaultValue: { summary: "" },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
parameters: {
|
|
29
|
+
docs: {
|
|
30
|
+
description: {
|
|
31
|
+
component:
|
|
32
|
+
"A component that renders a market dropdown for multimarket sites",
|
|
33
|
+
},
|
|
34
|
+
page: () => (
|
|
35
|
+
<>
|
|
36
|
+
<Title />
|
|
37
|
+
<Description />
|
|
38
|
+
<Primary />
|
|
39
|
+
<ArgsTable story={PRIMARY_STORY} />
|
|
40
|
+
</>
|
|
41
|
+
),
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const Template = (args) => (
|
|
47
|
+
<div style={{ width: "62px", position: "relative", margin: "0 auto" }}>
|
|
48
|
+
<Notifications {...args} />
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
export const Default = Template.bind({});
|
|
53
|
+
Default.args = {
|
|
54
|
+
section: {
|
|
55
|
+
modules: [
|
|
56
|
+
{
|
|
57
|
+
"mode": "image_text",
|
|
58
|
+
"name": "spotlights",
|
|
59
|
+
"items": [
|
|
60
|
+
{
|
|
61
|
+
"label": "Title Text",
|
|
62
|
+
"title": "Title Text",
|
|
63
|
+
"title_tag": "H2",
|
|
64
|
+
"subtitle": "Subtitle Text, Other Content",
|
|
65
|
+
"text": "<p>content text</p>",
|
|
66
|
+
"content": "<p>content text</p>",
|
|
67
|
+
"link": {
|
|
68
|
+
"type": "page",
|
|
69
|
+
"value": "/reviews/ice-casino-clone-1722429892393",
|
|
70
|
+
"title": null
|
|
71
|
+
},
|
|
72
|
+
"icon": null,
|
|
73
|
+
"icon_object": null,
|
|
74
|
+
"link_text": "Link Test Page",
|
|
75
|
+
"image": "1721908995/instagram2.svg",
|
|
76
|
+
"image_object": {
|
|
77
|
+
"width": "28",
|
|
78
|
+
"height": "28",
|
|
79
|
+
"url": "https://assets-srv.s3.eu-west-1.amazonaws.com/1721908995/instagram2.svg",
|
|
80
|
+
"title": "Instagram2",
|
|
81
|
+
"alt": null,
|
|
82
|
+
"filename": "1721908995/instagram2.svg"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"label": "Title Text",
|
|
87
|
+
"title": "Title Text",
|
|
88
|
+
"title_tag": "H2",
|
|
89
|
+
"subtitle": "Subtitle Text, Other Content",
|
|
90
|
+
"text": "<p>content text</p>",
|
|
91
|
+
"content": "<p>content text</p>",
|
|
92
|
+
"link": {
|
|
93
|
+
"type": "external",
|
|
94
|
+
"value": "/reviews/ice-casino-clone-1722429892393",
|
|
95
|
+
"title": null
|
|
96
|
+
},
|
|
97
|
+
"icon": null,
|
|
98
|
+
"icon_object": null,
|
|
99
|
+
"link_text": "Link Test Page",
|
|
100
|
+
"image": "1721908995/instagram2.svg",
|
|
101
|
+
"image_object": {
|
|
102
|
+
"width": "28",
|
|
103
|
+
"height": "28",
|
|
104
|
+
"url": "https://assets-srv.s3.eu-west-1.amazonaws.com/1721908995/instagram2.svg",
|
|
105
|
+
"title": "Instagram2",
|
|
106
|
+
"alt": null,
|
|
107
|
+
"filename": "1721908995/instagram2.svg"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { imagePrettyUrl, getImageFilename, getAltText } from 'gatsby-core-theme/src/helpers/getters';
|
|
4
|
+
import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
|
|
5
|
+
import keygen from 'gatsby-core-theme/src/helpers/keygen';
|
|
6
|
+
import Link from 'gatsby-core-theme/src/hooks/link';
|
|
7
|
+
import useTranslate from '~hooks/useTranslate/useTranslate';
|
|
8
|
+
import styles from './notification-items.module.scss';
|
|
9
|
+
|
|
10
|
+
const NotificationItems = ({ module, onClose }) => {
|
|
11
|
+
const { items } = module;
|
|
12
|
+
const noNewUpdates = useTranslate('noNewUpdates', 'No new items')
|
|
13
|
+
const content = (item) => {
|
|
14
|
+
const img = item?.image;
|
|
15
|
+
const imageSrc = imagePrettyUrl(img, 40, 40);
|
|
16
|
+
const fileName = getImageFilename(imageSrc);
|
|
17
|
+
const TitleTag = item?.title_tag || 'label';
|
|
18
|
+
const ribbon = item?.subtitle?.split(',')[0].replace('[null]', '');
|
|
19
|
+
const otherText = item?.subtitle?.split(',').slice(1);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div className={styles.notificationContent}>
|
|
23
|
+
{img && (
|
|
24
|
+
<LazyImage
|
|
25
|
+
width={40}
|
|
26
|
+
height={40}
|
|
27
|
+
alt={getAltText(item?.image_object, item?.label || item?.link_text || fileName)}
|
|
28
|
+
src={imageSrc}
|
|
29
|
+
/>
|
|
30
|
+
)}
|
|
31
|
+
{item?.label && <TitleTag>{item?.label}</TitleTag>}
|
|
32
|
+
{item?.text && (
|
|
33
|
+
<div className={styles.subtitle} dangerouslySetInnerHTML={{ __html: item?.text }} />
|
|
34
|
+
)}
|
|
35
|
+
{item?.subtitle && (
|
|
36
|
+
<div className={styles.ribbonAndTime}>
|
|
37
|
+
{ribbon && <span className={styles.ribbon}>{ribbon}</span>}
|
|
38
|
+
<span className={styles.extraContent}>{otherText}</span>
|
|
39
|
+
</div>
|
|
40
|
+
)}
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
return (
|
|
45
|
+
<div className={styles.container || ''}>
|
|
46
|
+
<div className={styles.notificationsContainer || ''}>
|
|
47
|
+
<span>
|
|
48
|
+
{useTranslate('latestUpdates', 'Latest Updates')}
|
|
49
|
+
<button type='button' onClick={onClose} className={styles.close || ''}>
|
|
50
|
+
<LazyImage
|
|
51
|
+
alt="Notification Bell"
|
|
52
|
+
width={16}
|
|
53
|
+
height={16}
|
|
54
|
+
src="/images/close.svg"
|
|
55
|
+
/>
|
|
56
|
+
</button>
|
|
57
|
+
</span>
|
|
58
|
+
{items?.length ? (
|
|
59
|
+
<ul className={styles.notifications || ''}>
|
|
60
|
+
{items.map((item) => (
|
|
61
|
+
<li className={`${styles.notification} notification-item-gtm`} key={keygen()}>
|
|
62
|
+
{item?.link &&
|
|
63
|
+
(item?.link?.type === 'external' ? (
|
|
64
|
+
<a
|
|
65
|
+
href={item?.link?.value}
|
|
66
|
+
className="spotlights-gtm"
|
|
67
|
+
title={item?.label}
|
|
68
|
+
target="_blank"
|
|
69
|
+
rel="noreferrer"
|
|
70
|
+
aria-label={`${item?.label || item?.link_text} Link`}
|
|
71
|
+
>
|
|
72
|
+
{content(item)}
|
|
73
|
+
</a>
|
|
74
|
+
) : (
|
|
75
|
+
<Link
|
|
76
|
+
to={item?.link?.value}
|
|
77
|
+
title={item?.label}
|
|
78
|
+
className="spotlights-gtm"
|
|
79
|
+
aria-label={`${item?.label || item?.link_text} Link`}
|
|
80
|
+
>
|
|
81
|
+
{content(item)}
|
|
82
|
+
</Link>
|
|
83
|
+
))}
|
|
84
|
+
</li>
|
|
85
|
+
))}
|
|
86
|
+
</ul>
|
|
87
|
+
) : (
|
|
88
|
+
<>{noNewUpdates}</>
|
|
89
|
+
)}
|
|
90
|
+
</div>
|
|
91
|
+
<div className={styles.triangle} />
|
|
92
|
+
<div
|
|
93
|
+
className={styles.overlay}
|
|
94
|
+
onKeyDown={onClose}
|
|
95
|
+
onClick={onClose}
|
|
96
|
+
role="button"
|
|
97
|
+
aria-label="Notification Bell Icon"
|
|
98
|
+
tabIndex={0}
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
NotificationItems.propTypes = {
|
|
105
|
+
module: PropTypes.shape({
|
|
106
|
+
items: PropTypes.arrayOf(PropTypes.shape({}))
|
|
107
|
+
}),
|
|
108
|
+
onClose: PropTypes.func
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export default NotificationItems;
|