gatsby-core-theme 1.6.8 → 1.6.12
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 +49 -0
- package/gatsby-node.esm.js +25 -34
- package/package.json +3 -2
- package/src/components/app-preview.js +37 -19
- package/src/components/app.js +76 -5
- package/src/components/atoms/scroll-to-top/index.js +29 -12
- package/src/components/atoms/scroll-to-top/scroll-to-top.module.scss +11 -2
- package/src/{pages → components/atoms}/sitemap/index.js +22 -20
- package/src/components/atoms/sitemap/sitemap.module.scss +111 -0
- package/src/components/atoms/sitemap/sitemap.stories.js +96 -0
- package/src/components/molecules/main/index.js +4 -1
- package/src/components/molecules/main/main.test.js +3 -3
- package/src/components/pages/body/index.js +1 -1
- package/src/components/pages/tracker/index.js +0 -4
- package/src/styles/utils/variables/_main.scss +6 -0
- package/src/pages/sitemap/sitemap.module.scss +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,52 @@
|
|
|
1
|
+
## [1.6.12](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v1.6.11...v1.6.12) (2021-11-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* tracker redirect fix ([cdcc2d4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cdcc2d4fb25bd3f16c17e3547f192a58b7e5bbfd))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
* Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([2bb149a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2bb149a0796a572868175b3c0a9e1307c88dc538))
|
|
10
|
+
|
|
11
|
+
## [1.6.11](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v1.6.10...v1.6.11) (2021-11-25)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* 404 ([2355a82](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2355a8216c6431f34bac5f6cc8dd5302446fb0f4))
|
|
17
|
+
* helmet ([6299dc5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6299dc536bcf7d3fac7ab89326fd0c6b42a692c9))
|
|
18
|
+
* helmet ([2a05f83](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2a05f83042de1490a64f5606052104d59dfb6768))
|
|
19
|
+
* preview ([5153a58](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5153a581700032ddad095e6a6e9593df8ac8dc8b))
|
|
20
|
+
* preview func ([16bb0dc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/16bb0dca646eb50da48ad98a09fe9d5022757177))
|
|
21
|
+
* tracker pages ([07c6e3c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/07c6e3c7d86190d82989ff270364a7ba940950c2))
|
|
22
|
+
* tracker pages ([6defb88](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6defb88aeac9d9f71051e8c9f739dc4b8d41f80d))
|
|
23
|
+
* tracker pages ([a61f2a8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a61f2a8db973fd5ba8098171e554883ac502e0a5))
|
|
24
|
+
* tracker pages ([e68afc4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e68afc4321955393f58da1dc7cb079dfc9383db1))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
* Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([7ffdc47](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7ffdc47fcc468429cd2ac02e482d53aa558e7c97))
|
|
28
|
+
|
|
29
|
+
## [1.6.10](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v1.6.9...v1.6.10) (2021-11-25)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* sitemap changed to a page from hercules ([a0e90e4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a0e90e4916fcc0a2918dde39971265cc48fe89da))
|
|
35
|
+
* sitemap fixes ([7c35ba4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7c35ba42cf54a937800140387b84278479caad92))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
* Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([a75119b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a75119b9e50cf2f5143242dcedc49b54abcfb6ce))
|
|
39
|
+
|
|
40
|
+
## [1.6.9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v1.6.8...v1.6.9) (2021-11-24)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Bug Fixes
|
|
44
|
+
|
|
45
|
+
* scroll-to-top fix ([8f7264c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8f7264cac3d4c0b11daaf1ddf5f08539e1bc5473))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
* Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([3d4fc0d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3d4fc0d86f199761b32785f0ced0ae1c8c3c5ebb))
|
|
49
|
+
|
|
1
50
|
## [1.6.8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v1.6.7...v1.6.8) (2021-11-24)
|
|
2
51
|
|
|
3
52
|
|
package/gatsby-node.esm.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
|
1
2
|
/* eslint no-console: ["error", { allow: ["log"] }], no-shadow: ["error", { "allow": ["marketSections", "prefilledModules"] }] */
|
|
2
3
|
/* eslint-disable dot-notation */
|
|
3
4
|
|
|
@@ -233,22 +234,35 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
|
|
|
233
234
|
});
|
|
234
235
|
} else if (page.path === '404') {
|
|
235
236
|
context404 = contextData;
|
|
237
|
+
} else if (page.path === 'sitemap') {
|
|
238
|
+
createPage({
|
|
239
|
+
path: `/${page.path}`,
|
|
240
|
+
component: require.resolve('./src/components/app.js'),
|
|
241
|
+
context: { ...contextData, sitemapData: { ...htmlSitemapPages }, templates },
|
|
242
|
+
});
|
|
236
243
|
} else {
|
|
237
244
|
createPage({
|
|
238
245
|
path: page.path.charAt(0) === '/' ? page.path : `/${page.path}`,
|
|
239
|
-
component: require.resolve(
|
|
240
|
-
page.path === 'preview'
|
|
241
|
-
? './src/components/app-preview.js'
|
|
242
|
-
: './src/components/app.js'
|
|
243
|
-
),
|
|
246
|
+
component: require.resolve('./src/components/app.js'),
|
|
244
247
|
context: {
|
|
245
248
|
...contextData,
|
|
246
249
|
siteSchema,
|
|
247
250
|
translations,
|
|
251
|
+
isPreview: page.path === 'preview',
|
|
248
252
|
},
|
|
249
253
|
});
|
|
250
254
|
}
|
|
251
255
|
|
|
256
|
+
const trackerPageObject = {
|
|
257
|
+
meta_title: 'Tracker',
|
|
258
|
+
template: 'tracker',
|
|
259
|
+
title: 'Tracker',
|
|
260
|
+
type: 'page',
|
|
261
|
+
language: languageKey,
|
|
262
|
+
path: '',
|
|
263
|
+
meta_robots: ['noindex', 'nofollow'],
|
|
264
|
+
};
|
|
265
|
+
|
|
252
266
|
// Operator tracker pages
|
|
253
267
|
if (page.type === 'operator') {
|
|
254
268
|
const operator = operators[page.relation_id];
|
|
@@ -258,10 +272,11 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
|
|
|
258
272
|
);
|
|
259
273
|
tracker.forEach((trackerPath) => {
|
|
260
274
|
// Create splash page
|
|
275
|
+
trackerPageObject['path'] = trackerPath;
|
|
261
276
|
createPage({
|
|
262
277
|
path: trackerPath,
|
|
263
|
-
component: require.resolve('./src/components/
|
|
264
|
-
context: { operator },
|
|
278
|
+
component: require.resolve('./src/components/app.js'),
|
|
279
|
+
context: { page: trackerPageObject, operator, isTracker: true },
|
|
265
280
|
});
|
|
266
281
|
});
|
|
267
282
|
}
|
|
@@ -281,7 +296,7 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
|
|
|
281
296
|
providerData.forEach((provider) => {
|
|
282
297
|
createPage({
|
|
283
298
|
path: provider.tracker,
|
|
284
|
-
component: require.resolve('./src/components/
|
|
299
|
+
component: require.resolve('./src/components/app.js'),
|
|
285
300
|
context: {
|
|
286
301
|
provider: provider.providerObject,
|
|
287
302
|
},
|
|
@@ -297,34 +312,10 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
|
|
|
297
312
|
exports.onCreatePage = ({ page, actions }) => {
|
|
298
313
|
const { createPage } = actions;
|
|
299
314
|
|
|
300
|
-
if (page.path.includes('
|
|
301
|
-
const pageNotFoundData = {
|
|
302
|
-
meta_title: 'Sitemap',
|
|
303
|
-
template: 'sitemap',
|
|
304
|
-
title: 'Site Map',
|
|
305
|
-
type: 'page',
|
|
306
|
-
sections: {
|
|
307
|
-
main: null,
|
|
308
|
-
navigation: null,
|
|
309
|
-
sidebar: null,
|
|
310
|
-
footer: null,
|
|
311
|
-
},
|
|
312
|
-
language: languageKey,
|
|
313
|
-
translations,
|
|
314
|
-
relation: {
|
|
315
|
-
sports,
|
|
316
|
-
},
|
|
317
|
-
};
|
|
318
|
-
page = Object.assign(pageNotFoundData, page); // eslint-disable-line no-param-reassign
|
|
319
|
-
createPage({
|
|
320
|
-
path: page.path,
|
|
321
|
-
component: require.resolve('./src/pages/sitemap/'),
|
|
322
|
-
context: { page, siteInfo, marketSections, sitemapData: { ...htmlSitemapPages }, templates },
|
|
323
|
-
});
|
|
324
|
-
} else if (page.path.includes('404')) {
|
|
315
|
+
if (page.path.includes('404')) {
|
|
325
316
|
createPage({
|
|
326
317
|
path: page.path,
|
|
327
|
-
component: require.resolve('./src/
|
|
318
|
+
component: require.resolve('./src/components/app.js'),
|
|
328
319
|
context: context404,
|
|
329
320
|
});
|
|
330
321
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gatsby-core-theme",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.12",
|
|
4
4
|
"description": "Gatsby Theme NPM Package",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
|
|
@@ -60,7 +60,8 @@
|
|
|
60
60
|
"react-google-recaptcha": "^2.1.0",
|
|
61
61
|
"react-helmet": "^6.0.0",
|
|
62
62
|
"react-icons": "^4.2.0",
|
|
63
|
-
"react-lazyload": "^2.6.5"
|
|
63
|
+
"react-lazyload": "^2.6.5",
|
|
64
|
+
"react-masonry-css": "^1.0.16"
|
|
64
65
|
},
|
|
65
66
|
"devDependencies": {
|
|
66
67
|
"@babel/core": "^7.13.1",
|
|
@@ -1,15 +1,28 @@
|
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
|
1
2
|
import React, { useEffect, useState } from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import { globalHistory } from '@reach/router';
|
|
4
5
|
|
|
5
|
-
import Body from '~pages/body';
|
|
6
|
-
import Head from '~organisms/head';
|
|
7
|
-
import { getPreview } from '~helpers/api';
|
|
6
|
+
// import Body from '~pages/body';
|
|
7
|
+
// import Head from '~organisms/head';
|
|
8
|
+
// import { getPreview } from '~helpers/api';
|
|
8
9
|
|
|
9
10
|
const AppPreview = ({ pageContext }) => {
|
|
10
11
|
const [previewContext, setPreviewContext] = useState({});
|
|
11
12
|
const [isLoading, setIsLoading] = useState({});
|
|
12
13
|
|
|
14
|
+
async function getData(searchParams, staticPath = null) {
|
|
15
|
+
const { getPreview } = await import('~helpers/api');
|
|
16
|
+
getPreview(
|
|
17
|
+
pageContext.siteName,
|
|
18
|
+
!staticPath ? searchParams.get('path') || '/' : staticPath,
|
|
19
|
+
pageContext
|
|
20
|
+
).then((previewResponse) => {
|
|
21
|
+
setPreviewContext(previewResponse);
|
|
22
|
+
setIsLoading(false);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
13
26
|
useEffect(() => {
|
|
14
27
|
setIsLoading(true);
|
|
15
28
|
const searchParams =
|
|
@@ -17,23 +30,28 @@ const AppPreview = ({ pageContext }) => {
|
|
|
17
30
|
if (!searchParams.get('path')) {
|
|
18
31
|
window.location = `${window.location.origin}/preview?path=/`;
|
|
19
32
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
);
|
|
33
|
+
|
|
34
|
+
getData(searchParams);
|
|
35
|
+
// let { hi, bye } = await import('./say.js');
|
|
36
|
+
// getPreview(pageContext.siteName, searchParams.get('path') || '/', pageContext).then(
|
|
37
|
+
// (previewResponse) => {
|
|
38
|
+
// setPreviewContext(previewResponse);
|
|
39
|
+
// setIsLoading(false);
|
|
40
|
+
// }
|
|
41
|
+
// );
|
|
26
42
|
|
|
27
43
|
globalHistory.listen(({ location }) => {
|
|
28
44
|
setIsLoading(true);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
45
|
+
|
|
46
|
+
getData(null, location.search.replace('?path=', ''));
|
|
47
|
+
// getPreview(pageContext.siteName, location.search.replace('?path=', ''), pageContext)
|
|
48
|
+
// .then((previewResponse) => {
|
|
49
|
+
// setPreviewContext(previewResponse);
|
|
50
|
+
// setIsLoading(false);
|
|
51
|
+
// })
|
|
52
|
+
// .catch(() => {
|
|
53
|
+
// alert('failed to load..');
|
|
54
|
+
// });
|
|
37
55
|
});
|
|
38
56
|
// eslint-disable-next-line
|
|
39
57
|
}, [pageContext.siteName]);
|
|
@@ -44,8 +62,8 @@ const AppPreview = ({ pageContext }) => {
|
|
|
44
62
|
|
|
45
63
|
return (
|
|
46
64
|
<>
|
|
47
|
-
<Head page={previewContext.page} siteInfo={previewContext.siteInfo} />
|
|
48
|
-
<Body pageContext={previewContext} />
|
|
65
|
+
{/* <Head page={previewContext.page} siteInfo={previewContext.siteInfo} />
|
|
66
|
+
<Body pageContext={previewContext} /> */}
|
|
49
67
|
</>
|
|
50
68
|
);
|
|
51
69
|
};
|
package/src/components/app.js
CHANGED
|
@@ -1,24 +1,95 @@
|
|
|
1
1
|
/* eslint-disable react/forbid-prop-types */
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import loadable from '@loadable/component';
|
|
5
|
+
import { globalHistory } from '@reach/router';
|
|
4
6
|
import TranslationsProvider from '~context/TranslationsProvider';
|
|
5
7
|
import Body from '~pages/body';
|
|
6
8
|
import Head from '~organisms/head';
|
|
7
9
|
|
|
8
10
|
const App = ({ pageContext }) => {
|
|
9
|
-
const { translations } = pageContext;
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
const { translations, isTracker, isPreview } = pageContext;
|
|
12
|
+
const [previewContext, setPreviewContext] = useState({});
|
|
13
|
+
const [isLoading, setIsLoading] = useState({});
|
|
14
|
+
|
|
15
|
+
async function getData(searchParams, staticPath = null) {
|
|
16
|
+
const { getPreview } = await import('~helpers/api');
|
|
17
|
+
getPreview(
|
|
18
|
+
pageContext.siteName,
|
|
19
|
+
!staticPath ? searchParams.get('path') || '/' : staticPath,
|
|
20
|
+
pageContext
|
|
21
|
+
).then((previewResponse) => {
|
|
22
|
+
setPreviewContext(previewResponse);
|
|
23
|
+
setIsLoading(false);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (isPreview) {
|
|
29
|
+
setIsLoading(true);
|
|
30
|
+
const searchParams =
|
|
31
|
+
typeof window !== 'undefined' ? new URLSearchParams(window.location.search) : null;
|
|
32
|
+
if (!searchParams.get('path')) {
|
|
33
|
+
window.location = `${window.location.origin}/preview?path=/`;
|
|
34
|
+
}
|
|
35
|
+
getData(searchParams);
|
|
36
|
+
// let { hi, bye } = await import('./say.js');
|
|
37
|
+
// getPreview(pageContext.siteName, searchParams.get('path') || '/', pageContext).then(
|
|
38
|
+
// (previewResponse) => {
|
|
39
|
+
// setPreviewContext(previewResponse);
|
|
40
|
+
// setIsLoading(false);
|
|
41
|
+
// }
|
|
42
|
+
// );
|
|
43
|
+
|
|
44
|
+
globalHistory.listen(({ location }) => {
|
|
45
|
+
setIsLoading(true);
|
|
46
|
+
|
|
47
|
+
getData(null, location.search.replace('?path=', ''));
|
|
48
|
+
// getPreview(pageContext.siteName, location.search.replace('?path=', ''), pageContext)
|
|
49
|
+
// .then((previewResponse) => {
|
|
50
|
+
// setPreviewContext(previewResponse);
|
|
51
|
+
// setIsLoading(false);
|
|
52
|
+
// })
|
|
53
|
+
// .catch(() => {
|
|
54
|
+
// alert('failed to load..');
|
|
55
|
+
// });
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
|
+
}, []);
|
|
60
|
+
|
|
61
|
+
if (isPreview) {
|
|
62
|
+
if (isLoading) {
|
|
63
|
+
return 'Loading...';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const TrackerContent = isTracker ? loadable(() => import(`~pages/tracker`)) : null;
|
|
68
|
+
|
|
69
|
+
return isTracker ? (
|
|
70
|
+
<>
|
|
12
71
|
<Head page={pageContext.page} siteInfo={pageContext.siteInfo} />
|
|
13
|
-
<
|
|
72
|
+
<TrackerContent pageContext={pageContext} path={pageContext.page.path} />
|
|
73
|
+
</>
|
|
74
|
+
) : (
|
|
75
|
+
<TranslationsProvider value={{ translations }}>
|
|
76
|
+
<Head
|
|
77
|
+
page={isPreview ? previewContext.page : pageContext.page}
|
|
78
|
+
siteInfo={isPreview ? previewContext.siteInfo : pageContext.siteInfo}
|
|
79
|
+
/>
|
|
80
|
+
<Body pageContext={isPreview ? previewContext : pageContext} />
|
|
14
81
|
</TranslationsProvider>
|
|
15
82
|
);
|
|
16
83
|
};
|
|
17
84
|
|
|
18
85
|
App.propTypes = {
|
|
19
86
|
pageContext: PropTypes.shape({
|
|
87
|
+
siteName: PropTypes.string,
|
|
88
|
+
isTracker: PropTypes.bool,
|
|
89
|
+
isPreview: PropTypes.bool,
|
|
20
90
|
page: PropTypes.shape({
|
|
21
91
|
id: PropTypes.number,
|
|
92
|
+
path: PropTypes.string,
|
|
22
93
|
}),
|
|
23
94
|
translations: PropTypes.object,
|
|
24
95
|
siteInfo: PropTypes.shape({
|
|
@@ -1,25 +1,42 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
|
-
import { registerScroll } from '~helpers/scroll';
|
|
5
4
|
import styles from './scroll-to-top.module.scss';
|
|
6
5
|
|
|
7
6
|
const ScrollToTop = ({ scrollTo = '0' }) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
}
|
|
7
|
+
const [showScroll, setShowScroll] = useState(false);
|
|
8
|
+
|
|
9
|
+
const checkScrollTop = () => {
|
|
10
|
+
if (!showScroll && window.pageYOffset > 400) {
|
|
11
|
+
setShowScroll(true);
|
|
12
|
+
} else if (showScroll && window.pageYOffset <= 400) {
|
|
13
|
+
setShowScroll(false);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const scrollTop = () => {
|
|
18
|
+
window.scrollTo({ top: scrollTo, behavior: 'smooth' });
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (typeof window !== 'undefined') {
|
|
23
|
+
window.addEventListener('scroll', checkScrollTop);
|
|
24
|
+
|
|
25
|
+
return () => {
|
|
26
|
+
window.removeEventListener('scroll', checkScrollTop);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return null;
|
|
31
|
+
});
|
|
32
|
+
|
|
17
33
|
return (
|
|
18
34
|
<button
|
|
19
35
|
type="button"
|
|
20
36
|
aria-label="Scroll to top"
|
|
21
|
-
onClick={(e) =>
|
|
37
|
+
onClick={(e) => scrollTop(e)}
|
|
22
38
|
className={styles.scrollToTop}
|
|
39
|
+
style={{ display: showScroll ? 'flex' : 'none' }}
|
|
23
40
|
/>
|
|
24
41
|
);
|
|
25
42
|
};
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
body[data-scroll='0'] {
|
|
2
|
+
.scrollToTop {
|
|
3
|
+
opacity: 0;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
1
7
|
.scrollToTop {
|
|
2
8
|
z-index: map-get($z-index, scroll-to-top);
|
|
3
9
|
border-radius: 50%;
|
|
@@ -6,9 +12,12 @@
|
|
|
6
12
|
width: 64px;
|
|
7
13
|
height: 64px;
|
|
8
14
|
text-align: center;
|
|
9
|
-
|
|
15
|
+
bottom: 0;
|
|
16
|
+
position: fixed;
|
|
17
|
+
right: 0;
|
|
18
|
+
|
|
10
19
|
&:before {
|
|
11
|
-
@include arrow(#
|
|
20
|
+
@include arrow(#000, 2rem, up, false);
|
|
12
21
|
position: absolute;
|
|
13
22
|
bottom: calc(50% - 1.25rem);
|
|
14
23
|
left: calc(50% - 1rem);
|
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
/* eslint-disable array-callback-return */
|
|
2
2
|
/* eslint-disable react/forbid-prop-types */
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useContext } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
+
import { BiSitemap } from 'react-icons/bi';
|
|
6
|
+
import { IoMdLink } from 'react-icons/io';
|
|
7
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
8
|
+
import Masonry from 'react-masonry-css';
|
|
9
|
+
import { Context } from '~context/TranslationsProvider';
|
|
10
|
+
import { translate } from '~helpers/getters';
|
|
5
11
|
import styles from './sitemap.module.scss';
|
|
6
|
-
import Body from '~pages/body';
|
|
7
|
-
import Head from '~organisms/head';
|
|
8
12
|
import Link from '~hooks/link';
|
|
9
13
|
|
|
10
|
-
const Sitemap = ({ pageContext, templateIcon
|
|
14
|
+
const Sitemap = ({ pageContext, templateIcon = <BiSitemap />, linkIcon = <IoMdLink /> }) => {
|
|
11
15
|
const { templates, sitemapData } = pageContext;
|
|
16
|
+
const { translations } = useContext(Context) || {};
|
|
12
17
|
const market = Object.keys(sitemapData)[0];
|
|
13
18
|
|
|
14
19
|
const getTemplateName = (template) => {
|
|
15
|
-
const templateName =
|
|
20
|
+
const templateName = translate(
|
|
21
|
+
translations,
|
|
22
|
+
templates[template].short_name,
|
|
23
|
+
templates[template].short_name.replace('_', ' ')
|
|
24
|
+
);
|
|
16
25
|
const templatePages = sitemapData[market][template];
|
|
17
26
|
const templatePagesCount = templatePages && templatePages.length;
|
|
18
27
|
|
|
@@ -47,19 +56,14 @@ const Sitemap = ({ pageContext, templateIcon, linkIcon }) => {
|
|
|
47
56
|
};
|
|
48
57
|
|
|
49
58
|
return (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
</ul>
|
|
59
|
-
))}
|
|
60
|
-
</div>
|
|
61
|
-
</Body>
|
|
62
|
-
</>
|
|
59
|
+
<Masonry breakpointCols={3} className={styles.container} columnClassName={styles.list}>
|
|
60
|
+
{Object.keys(templates).map((template) => (
|
|
61
|
+
<ul key={template}>
|
|
62
|
+
{getTemplateName(template)}
|
|
63
|
+
{getTemplatePages(template)}
|
|
64
|
+
</ul>
|
|
65
|
+
))}
|
|
66
|
+
</Masonry>
|
|
63
67
|
);
|
|
64
68
|
};
|
|
65
69
|
|
|
@@ -67,8 +71,6 @@ Sitemap.propTypes = {
|
|
|
67
71
|
pageContext: PropTypes.shape({
|
|
68
72
|
sitemapData: PropTypes.object,
|
|
69
73
|
templates: PropTypes.object,
|
|
70
|
-
siteInfo: PropTypes.object,
|
|
71
|
-
page: PropTypes.object,
|
|
72
74
|
}),
|
|
73
75
|
templateIcon: PropTypes.element,
|
|
74
76
|
linkIcon: PropTypes.element,
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
display: flex;
|
|
3
|
+
max-width: var(--main-container-max);
|
|
4
|
+
margin: 0 auto;
|
|
5
|
+
padding: 0 2.4rem 2rem 2.4rem;
|
|
6
|
+
|
|
7
|
+
@include min(mobile) {
|
|
8
|
+
padding: 0 1.6rem 2rem 1.6rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@include max(mobile) {
|
|
12
|
+
display: block;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.list {
|
|
17
|
+
@include max(mobile) {
|
|
18
|
+
width: 100% !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
> ul {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
padding: 1rem;
|
|
25
|
+
|
|
26
|
+
> div {
|
|
27
|
+
position: relative;
|
|
28
|
+
@include flex-align(center, flex-start);
|
|
29
|
+
|
|
30
|
+
svg {
|
|
31
|
+
fill: white !important;
|
|
32
|
+
background-color: var(--template-name-icon-background, red);
|
|
33
|
+
padding: 1rem;
|
|
34
|
+
width: 4.8rem;
|
|
35
|
+
height: 4.8rem;
|
|
36
|
+
border-radius: 2.8rem;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
> span {
|
|
40
|
+
color: black;
|
|
41
|
+
font-weight: 700;
|
|
42
|
+
font-size: 2rem;
|
|
43
|
+
margin-left: 1.6rem;
|
|
44
|
+
text-transform: capitalize;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
span:last-child {
|
|
48
|
+
@include flex-align(center, center);
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: -1.2rem;
|
|
51
|
+
background-color: var(--page-number-background, green);
|
|
52
|
+
border-radius: 1.2rem;
|
|
53
|
+
border: 0.2rem solid white;
|
|
54
|
+
margin: 0;
|
|
55
|
+
font-size: 1rem;
|
|
56
|
+
color: var(--page-number-color, white);
|
|
57
|
+
font-weight: 700;
|
|
58
|
+
width: 2.4rem;
|
|
59
|
+
height: 2.4rem;
|
|
60
|
+
left: 3.2rem;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
> ul {
|
|
65
|
+
padding-top: 3rem;
|
|
66
|
+
padding-left: 2.7rem;
|
|
67
|
+
margin-left: 2.3rem;
|
|
68
|
+
border-left: dashed 1px #e3e6ef;
|
|
69
|
+
|
|
70
|
+
li {
|
|
71
|
+
display: grid;
|
|
72
|
+
grid-template-columns: 0.1fr 1fr;
|
|
73
|
+
gap: 0.5rem;
|
|
74
|
+
margin-bottom: 1rem;
|
|
75
|
+
position: relative;
|
|
76
|
+
|
|
77
|
+
&:before {
|
|
78
|
+
content: ' ';
|
|
79
|
+
position: absolute;
|
|
80
|
+
left: -2.7rem;
|
|
81
|
+
width: 2.5rem;
|
|
82
|
+
top: 1.2rem;
|
|
83
|
+
border: dashed 1px #e3e6ef;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&:last-child:after {
|
|
87
|
+
content: ' ';
|
|
88
|
+
width: 1rem;
|
|
89
|
+
height: 5rem;
|
|
90
|
+
background-color: var(--sitemap-background-color);
|
|
91
|
+
position: absolute;
|
|
92
|
+
top: 1.3rem;
|
|
93
|
+
left: -2.8rem;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
svg {
|
|
97
|
+
fill: white !important;
|
|
98
|
+
background-color: #6e6e84;
|
|
99
|
+
padding: 0.3rem;
|
|
100
|
+
width: 2.4rem;
|
|
101
|
+
height: 2.4rem;
|
|
102
|
+
border-radius: 0.8rem;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
a {
|
|
106
|
+
padding-left: 0.3rem;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
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 Sitemap from '.';
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
title: 'Gatsby-Theme/Atoms/Sitemap',
|
|
15
|
+
component: Sitemap,
|
|
16
|
+
argTypes: {
|
|
17
|
+
// pageContext: {
|
|
18
|
+
// name: 'sitemapData',
|
|
19
|
+
// type: { name: 'object', required: true },
|
|
20
|
+
// defaultValue: null,
|
|
21
|
+
// description: 'Object containing all links grouped by page type.',
|
|
22
|
+
// table: {
|
|
23
|
+
// type: { summary: 'object' },
|
|
24
|
+
// defaultValue: { summary: null },
|
|
25
|
+
// },
|
|
26
|
+
// },
|
|
27
|
+
},
|
|
28
|
+
parameters: {
|
|
29
|
+
docs: {
|
|
30
|
+
description: {
|
|
31
|
+
component: 'An HTML sitemap showing all pages as links',
|
|
32
|
+
},
|
|
33
|
+
page: () => (
|
|
34
|
+
<>
|
|
35
|
+
<Title />
|
|
36
|
+
<Description />
|
|
37
|
+
<Primary />
|
|
38
|
+
<ArgsTable story={PRIMARY_STORY} />
|
|
39
|
+
</>
|
|
40
|
+
),
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const Template = (args) => <Sitemap {...args} />;
|
|
46
|
+
|
|
47
|
+
export const Default = Template.bind({});
|
|
48
|
+
Default.args = {
|
|
49
|
+
pageContext: {
|
|
50
|
+
sitemapData: {
|
|
51
|
+
ie_en: {
|
|
52
|
+
1: [
|
|
53
|
+
{
|
|
54
|
+
title: 'test one',
|
|
55
|
+
path: '/test_one',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
title: 'test two',
|
|
59
|
+
path: '/test_two',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
title: 'test three',
|
|
63
|
+
path: '/test_three',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
2: [
|
|
67
|
+
{
|
|
68
|
+
title: 'template page one',
|
|
69
|
+
path: '/template_page_one',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
title: 'template page two',
|
|
73
|
+
path: '/template_page_two',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
3: [
|
|
77
|
+
{
|
|
78
|
+
title: 'template two page',
|
|
79
|
+
path: 'template_teo_page',
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
templates: {
|
|
85
|
+
1: {
|
|
86
|
+
short_name: 'template one',
|
|
87
|
+
},
|
|
88
|
+
2: {
|
|
89
|
+
short_name: 'template two',
|
|
90
|
+
},
|
|
91
|
+
3: {
|
|
92
|
+
short_name: 'template three',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
};
|
|
@@ -5,14 +5,17 @@ import Module from '~molecules/module';
|
|
|
5
5
|
import styles from './main.module.scss';
|
|
6
6
|
import keygen from '~helpers/keygen';
|
|
7
7
|
|
|
8
|
-
const Main = ({ section = {},
|
|
8
|
+
const Main = ({ section = {}, pageContext = {} }) => {
|
|
9
|
+
const { page } = pageContext;
|
|
9
10
|
const SearchPage = page.path === 's' ? loadable(() => import(`~pages/search`)) : null;
|
|
11
|
+
const HtmlSitemap = page.path === 'sitemap' ? loadable(() => import(`~atoms/sitemap`)) : null;
|
|
10
12
|
const AuthorBox = page.author ? loadable(() => import(`~atoms/author-box`)) : null;
|
|
11
13
|
const NotFound = page?.path?.includes('404') ? loadable(() => import(`~atoms/not-found`)) : null;
|
|
12
14
|
|
|
13
15
|
return (
|
|
14
16
|
<main className={styles.modulePage}>
|
|
15
17
|
{NotFound && <NotFound />}
|
|
18
|
+
{HtmlSitemap && <HtmlSitemap pageContext={pageContext} />}
|
|
16
19
|
{section.modules &&
|
|
17
20
|
section.modules.map((module) => (
|
|
18
21
|
<Module key={keygen()} module={module} page={page} pageContext={pageContext} />
|
|
@@ -10,16 +10,16 @@ const section = {
|
|
|
10
10
|
modules: [
|
|
11
11
|
{
|
|
12
12
|
name: 'content',
|
|
13
|
-
...getSingleContentData()
|
|
13
|
+
...getSingleContentData(),
|
|
14
14
|
},
|
|
15
15
|
],
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const pageObject = { page: { path: 's' } };
|
|
19
19
|
|
|
20
20
|
describe('Main Component', () => {
|
|
21
21
|
test('render main', async () => {
|
|
22
|
-
const { container, getByText } = render(<Main section={section}
|
|
22
|
+
const { container, getByText } = render(<Main section={section} pageContext={pageObject} />);
|
|
23
23
|
expect(container).toBeTruthy();
|
|
24
24
|
expect(container.querySelectorAll('main.modulePage')).toHaveLength(1);
|
|
25
25
|
|
|
@@ -24,7 +24,7 @@ function Body({ pageContext, children }) {
|
|
|
24
24
|
<>
|
|
25
25
|
{navigation && <Navigation template={template} section={navigation} />}
|
|
26
26
|
{!is404 && <Header section={pageContext} />}
|
|
27
|
-
{main && !children && <Main section={main}
|
|
27
|
+
{main && !children && <Main section={main} pageContext={pageContext} />}
|
|
28
28
|
{children && <main>{children}</main>}
|
|
29
29
|
{Sidebar && <Sidebar section={sidebar} />}
|
|
30
30
|
<ScrollToTop />
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { Helmet } from 'react-helmet';
|
|
4
3
|
import Button from '~atoms/button';
|
|
5
4
|
import LazyImage from '~hooks/lazy-image';
|
|
6
5
|
import { prettyTracker } from '~helpers/getters';
|
|
@@ -91,9 +90,6 @@ const Tracker = ({
|
|
|
91
90
|
<>
|
|
92
91
|
{showSplashScreen && !isMobile && (
|
|
93
92
|
<>
|
|
94
|
-
<Helmet>
|
|
95
|
-
<meta name="robots" content="noindex,nofollow" />
|
|
96
|
-
</Helmet>
|
|
97
93
|
<div className={styles.container}>
|
|
98
94
|
{background}
|
|
99
95
|
<div className={styles.content}>
|
|
@@ -77,6 +77,12 @@
|
|
|
77
77
|
--second-table-background: var(--color-17);
|
|
78
78
|
--secondary-module-background: var(--color-42);
|
|
79
79
|
|
|
80
|
+
// HTML Sitemap
|
|
81
|
+
--template-name-icon-background: #ff893f;
|
|
82
|
+
--page-number-background: #393939;
|
|
83
|
+
--page-number-color: #fff;
|
|
84
|
+
--sitemap-background-color: #fff;
|
|
85
|
+
|
|
80
86
|
--storybook-soccer: var(--color-45);
|
|
81
87
|
--storybook-tennis: var(--color-46);
|
|
82
88
|
--storybook-handball: var(--color-47);
|