generator-folklore 3.0.30 → 3.0.33
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/lib/generators/build/index.js +0 -12
- package/lib/generators/html-project/index.js +5 -0
- package/lib/generators/laravel-project/index.js +4 -0
- package/lib/generators/micromag-project/index.js +82 -25
- package/lib/generators/micromag-project/templates/App.tsx +50 -0
- package/lib/generators/micromag-project/templates/Layout.tsx +38 -0
- package/lib/generators/micromag-project/templates/MicromagPage.tsx +73 -0
- package/lib/generators/micromag-project/templates/Routes.tsx +32 -0
- package/lib/generators/micromag-project/templates/contexts/AnalyticsContext.tsx +44 -0
- package/lib/generators/micromag-project/templates/contexts/ModalContext.tsx +69 -0
- package/lib/generators/micromag-project/templates/hooks/useKeyboardKeys.ts +29 -0
- package/lib/generators/micromag-project/templates/hooks/useMicromagPreview.ts +15 -0
- package/lib/generators/micromag-project/templates/hooks/useMicromagStory.ts +48 -0
- package/lib/generators/micromag-project/templates/hooks/useMicromagVideo.ts +40 -0
- package/lib/generators/micromag-project/templates/hooks/useParseFonts.ts +15 -0
- package/lib/generators/micromag-project/templates/hooks/useStoryTrackingVariables.ts +41 -0
- package/lib/generators/micromag-project/templates/icons/Cookie.tsx +22 -0
- package/lib/generators/micromag-project/templates/index.html.ejs +95 -0
- package/lib/generators/micromag-project/templates/kiosk/HomePage.tsx +35 -0
- package/lib/generators/micromag-project/templates/kiosk/Routes.tsx +47 -0
- package/lib/generators/micromag-project/templates/kiosk/home-page.module.css +83 -0
- package/lib/generators/micromag-project/templates/kiosk/micromags.ts +13 -0
- package/lib/generators/micromag-project/templates/kiosk/styles.css +86 -0
- package/lib/generators/micromag-project/templates/layout.module.css +26 -0
- package/lib/generators/micromag-project/templates/lib/addTrackingCodesToStory.ts +26 -0
- package/lib/generators/micromag-project/templates/micromags.ts +13 -0
- package/lib/generators/micromag-project/templates/modals/Consent.tsx +63 -0
- package/lib/generators/micromag-project/templates/partials/Micromag.tsx +156 -0
- package/lib/generators/micromag-project/templates/partials/Preview.tsx +28 -0
- package/lib/generators/micromag-project/templates/partials/Thumbnail.tsx +24 -0
- package/lib/generators/micromag-project/templates/partials/Video.tsx +36 -0
- package/lib/generators/micromag-project/templates/styles/modals/consent.module.css +150 -0
- package/lib/generators/micromag-project/templates/styles/pages/micromag.module.css +6 -0
- package/lib/generators/micromag-project/templates/styles/partials/micromag.module.css +17 -0
- package/lib/generators/micromag-project/templates/styles/partials/preview.module.css +3 -0
- package/lib/generators/micromag-project/templates/styles/partials/thumbnail.module.css +3 -0
- package/lib/generators/micromag-project/templates/styles/partials/video.module.css +3 -0
- package/lib/generators/micromag-project/templates/styles.css +85 -2
- package/lib/generators/micromag-project/templates/types/micromag.d.ts +58 -0
- package/lib/generators/react-app/templates/types/base.d.ts +1 -0
- package/lib/generators/typescript/index.js +50 -0
- package/lib/generators/typescript/templates/_tsconfig.json +8 -0
- package/package.json +3 -3
- package/lib/generators/build/templates/.jsconfig.json +0 -9
- package/lib/generators/build/templates/.tsconfig.json +0 -7
- package/lib/generators/micromag-project/templates/Home.jsx +0 -33
- package/lib/generators/micromag-project/templates/Routes.jsx +0 -26
- package/lib/generators/micromag-project/templates/home.module.css +0 -19
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import isEmpty from 'lodash/isEmpty';
|
|
2
|
+
import uniq from 'lodash/uniq';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
|
|
5
|
+
import { MicromagStory } from '../types/micromag';
|
|
6
|
+
|
|
7
|
+
export function useStoryTrackingVariables(story: MicromagStory): Record<string, unknown> {
|
|
8
|
+
const trackingVariables = useMemo(() => {
|
|
9
|
+
// Organisation level
|
|
10
|
+
const { organisation = null, document_id: documentId = null } = story || {};
|
|
11
|
+
const { slug: organisationSlug = null, tracking = {} } = organisation || {};
|
|
12
|
+
const { codes: orgCodes = [] } = tracking || {};
|
|
13
|
+
|
|
14
|
+
const orgGoogleAnalyticsIds = (orgCodes || [])
|
|
15
|
+
.filter((orgCode) => {
|
|
16
|
+
const { type, id } = orgCode || {};
|
|
17
|
+
return type === 'ga' && !isEmpty(id);
|
|
18
|
+
})
|
|
19
|
+
.map(({ id }) => id);
|
|
20
|
+
|
|
21
|
+
// Story level
|
|
22
|
+
const { tracking: { codes: storyCodes = [] } = {} } =
|
|
23
|
+
story !== null ? story.settings || {} : {};
|
|
24
|
+
|
|
25
|
+
const storyGoogleAnalyticsIds = (storyCodes || [])
|
|
26
|
+
.filter((storyCode) => {
|
|
27
|
+
const { type, id } = storyCode || {};
|
|
28
|
+
return (type === 'ga' || type === 'ga4') && !isEmpty(id);
|
|
29
|
+
})
|
|
30
|
+
.map(({ id }) => id);
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
documentId,
|
|
34
|
+
organisationSlug,
|
|
35
|
+
clientGoogleAnalyticsIds: uniq([...orgGoogleAnalyticsIds, ...storyGoogleAnalyticsIds]),
|
|
36
|
+
};
|
|
37
|
+
}, [story]);
|
|
38
|
+
return trackingVariables;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default useStoryTrackingVariables;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
|
|
3
|
+
function Cookie({ className = null }) {
|
|
4
|
+
return (
|
|
5
|
+
<svg
|
|
6
|
+
className={classNames(className)}
|
|
7
|
+
width="600px"
|
|
8
|
+
height="600px"
|
|
9
|
+
viewBox="0 0 600 600"
|
|
10
|
+
fill="none"
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
|
+
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
13
|
+
>
|
|
14
|
+
<path
|
|
15
|
+
fill="#FFF"
|
|
16
|
+
d="M300,0C134.3,0,0,134.3,0,300s134.3,300,300,300,300-134.3,300-300-.9-24-2.3-35.8c-10,6.8-22.1,10.8-35.2,10.8-27,0-49.7-17.2-58.5-41-15.6,10-34.1,16-54,16-55.3,0-100-44.7-100-100s5.3-35.4,14-50.2c-.5,0-1,.2-1.5.2-34.6,0-62.5-27.9-62.5-62.5s4.7-26.7,12.4-37c-4.1-.2-8.2-.5-12.4-.5ZM487.5,0c-20.7,0-37.5,16.8-37.5,37.5s16.8,37.5,37.5,37.5,37.5-16.8,37.5-37.5S508.2,0,487.5,0ZM251.3,54.7c5,32.2,23.7,60,49.9,77.1-.8,6-1.2,12.1-1.2,18.2,0,82.7,67.3,150,150,150s24.8-1.6,36.7-4.7c17.1,15.6,38.7,26,62.1,28.9-12.2,126.6-119.1,225.8-248.8,225.8S50,437.9,50,300,136.7,77.4,251.3,54.7ZM450,125c-13.8,0-25,11.2-25,25s11.2,25,25,25,25-11.2,25-25-11.2-25-25-25ZM250,150c-13.8,0-25,11.2-25,25s11.2,25,25,25,25-11.2,25-25-11.2-25-25-25ZM575,150c-13.8,0-25,11.2-25,25s11.2,25,25,25,25-11.2,25-25-11.2-25-25-25ZM175,225c-27.6,0-50,22.4-50,50s22.4,50,50,50,50-22.4,50-50-22.4-50-50-50ZM300,275c-13.8,0-25,11.2-25,25s11.2,25,25,25,25-11.2,25-25-11.2-25-25-25ZM212.5,375c-20.7,0-37.5,16.8-37.5,37.5s16.8,37.5,37.5,37.5,37.5-16.8,37.5-37.5-16.8-37.5-37.5-37.5ZM387.5,400c-20.7,0-37.5,16.8-37.5,37.5s16.8,37.5,37.5,37.5,37.5-16.8,37.5-37.5-16.8-37.5-37.5-37.5Z"
|
|
17
|
+
/>
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default Cookie;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<!--[if IE]> <html class="ie" lang="fr"> <![endif]-->
|
|
3
|
+
<!--[if !(IE)]><!-->
|
|
4
|
+
<html lang="fr">
|
|
5
|
+
<!--<![endif]-->
|
|
6
|
+
<head>
|
|
7
|
+
<meta charset="utf-8" />
|
|
8
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
|
9
|
+
|
|
10
|
+
<title></title>
|
|
11
|
+
|
|
12
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
13
|
+
<meta name="description" content="" />
|
|
14
|
+
|
|
15
|
+
<meta property="og:locale" content="fr_CA" />
|
|
16
|
+
<meta property="og:image" content="/static/media/facebook.jpg" />
|
|
17
|
+
<meta property="og:title" content="Espace pour la vie - Micromags" />
|
|
18
|
+
<meta property="og:type" content="website" />
|
|
19
|
+
<meta property="og:description" content="" />
|
|
20
|
+
<meta property="og:url" content="/" />
|
|
21
|
+
|
|
22
|
+
<link rel="shortcut icon" href="/static/media/favicon.ico" />
|
|
23
|
+
|
|
24
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
25
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
26
|
+
|
|
27
|
+
<script type="text/javascript">
|
|
28
|
+
var TAG_MANAGER_ID = '';
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<!-- Google Tag Manager -->
|
|
32
|
+
<script>
|
|
33
|
+
(function (w, d, s, l, i) {
|
|
34
|
+
w[l] = w[l] || [];
|
|
35
|
+
w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
|
|
36
|
+
var f = d.getElementsByTagName(s)[0],
|
|
37
|
+
j = d.createElement(s),
|
|
38
|
+
dl = l != 'dataLayer' ? '&l=' + l : '';
|
|
39
|
+
j.async = true;
|
|
40
|
+
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
|
|
41
|
+
f.parentNode.insertBefore(j, f);
|
|
42
|
+
window.dataLayer = window.dataLayer || [];
|
|
43
|
+
function gtag() {
|
|
44
|
+
dataLayer.push(arguments);
|
|
45
|
+
}
|
|
46
|
+
window.gtag = gtag;
|
|
47
|
+
function getCookieValue(name) {
|
|
48
|
+
const regex = new RegExp(`(^| )${name}=([^;]+)`);
|
|
49
|
+
const match = document.cookie.match(regex);
|
|
50
|
+
if (match) {
|
|
51
|
+
return match[2];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const defaultConsent = {
|
|
55
|
+
ad_storage: getCookieValue('ad_storage') === 'granted' ? 'granted' : 'denied',
|
|
56
|
+
ad_user_data:
|
|
57
|
+
getCookieValue('ad_user_data') === 'granted' ? 'granted' : 'denied',
|
|
58
|
+
ad_personalization:
|
|
59
|
+
getCookieValue('ad_personalization') === 'granted' ? 'granted' : 'denied',
|
|
60
|
+
personalization_storage:
|
|
61
|
+
getCookieValue('personalization_storage') === 'granted'
|
|
62
|
+
? 'granted'
|
|
63
|
+
: 'denied',
|
|
64
|
+
analytics_storage:
|
|
65
|
+
getCookieValue('analytics_storage') === 'granted' ? 'granted' : 'denied',
|
|
66
|
+
functionality_storage: 'granted',
|
|
67
|
+
security_storage: 'granted',
|
|
68
|
+
};
|
|
69
|
+
gtag('consent', 'default', defaultConsent);
|
|
70
|
+
})(window, document, 'script', 'dataLayer', TAG_MANAGER_ID);
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<!-- End Google Tag Manager -->
|
|
74
|
+
</head>
|
|
75
|
+
<body>
|
|
76
|
+
<!-- Google Tag Manager (noscript) -->
|
|
77
|
+
<noscript
|
|
78
|
+
><iframe
|
|
79
|
+
src="https://www.googletagmanager.com/ns.html?id="
|
|
80
|
+
height="0"
|
|
81
|
+
width="0"
|
|
82
|
+
style="display: none; visibility: hidden"
|
|
83
|
+
></iframe
|
|
84
|
+
></noscript>
|
|
85
|
+
|
|
86
|
+
<!-- End Google Tag Manager (noscript) -->
|
|
87
|
+
<script type="text/javascript">
|
|
88
|
+
var props = {
|
|
89
|
+
googleAnalyticsIds: [],
|
|
90
|
+
tagManagerId: TAG_MANAGER_ID,
|
|
91
|
+
};
|
|
92
|
+
</script>
|
|
93
|
+
<div id="app"></div>
|
|
94
|
+
</body>
|
|
95
|
+
</html>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Link, Redirect } from 'wouter';
|
|
2
|
+
|
|
3
|
+
import Thumbnail from '../partials/Thumbnail';
|
|
4
|
+
|
|
5
|
+
import styles from '<%= getRelativeStylesPath('components/pages/Home.jsx', 'pages/home.module.css') %>';
|
|
6
|
+
|
|
7
|
+
interface HomePageProps {
|
|
8
|
+
screen?: string | null;
|
|
9
|
+
micromags?: Record<string, any> | null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function HomePage({ micromags = null }: HomePageProps) {
|
|
13
|
+
if (micromags === null || micromags.length === 0) {
|
|
14
|
+
return <div className={styles.container} />;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (micromags.length === 1) {
|
|
18
|
+
return <Redirect to={`/${micromags[0].slug}`} />;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div className={styles.container}>
|
|
23
|
+
<div className={styles.grid}>
|
|
24
|
+
{(micromags || []).map((micromag) => (
|
|
25
|
+
<Link key={micromag.id} href={`/${micromag.slug}`} className={styles.cellLink}>
|
|
26
|
+
<Thumbnail micromag={micromag} className={styles.cell} />
|
|
27
|
+
</Link>
|
|
28
|
+
))}
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default HomePage;
|
|
35
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useRoutes } from '@folklore/routes';
|
|
2
|
+
import { Route, Switch } from 'wouter';
|
|
3
|
+
|
|
4
|
+
import { MicromagItem } from '../types/micromag';
|
|
5
|
+
import MainLayout from './layouts/Main';
|
|
6
|
+
import HomePage from './pages/Home';
|
|
7
|
+
import MicromagPage from './pages/Micromag';
|
|
8
|
+
|
|
9
|
+
interface RoutesProps {
|
|
10
|
+
micromags?: MicromagItem[] | null;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function Routes({ micromags = null, loading = false }: RoutesProps) {
|
|
15
|
+
const routes = useRoutes() || {};
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Switch>
|
|
19
|
+
<Route path="/:micromag/:screen?">
|
|
20
|
+
{({
|
|
21
|
+
micromag: micromagSlug = null,
|
|
22
|
+
screen = null,
|
|
23
|
+
}: {
|
|
24
|
+
micromag: string;
|
|
25
|
+
screen?: string;
|
|
26
|
+
}) => (
|
|
27
|
+
<MainLayout>
|
|
28
|
+
<MicromagPage
|
|
29
|
+
micromag={
|
|
30
|
+
(micromags || []).find(({ slug }) => slug === micromagSlug) || null
|
|
31
|
+
}
|
|
32
|
+
screen={screen}
|
|
33
|
+
hasHome
|
|
34
|
+
/>
|
|
35
|
+
</MainLayout>
|
|
36
|
+
)}
|
|
37
|
+
</Route>
|
|
38
|
+
<Route>
|
|
39
|
+
<MainLayout>
|
|
40
|
+
<HomePage micromags={micromags} />
|
|
41
|
+
</MainLayout>
|
|
42
|
+
</Route>
|
|
43
|
+
</Switch>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default Routes;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
min-height: 100%;
|
|
5
|
+
|
|
6
|
+
.hero {
|
|
7
|
+
display: flex;
|
|
8
|
+
width: 100%;
|
|
9
|
+
flex-direction: row;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
padding: 40px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.heroLink {
|
|
16
|
+
display: block;
|
|
17
|
+
max-height: 60svh;
|
|
18
|
+
aspect-ratio: 9 / 16;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.heroThumbnail {
|
|
22
|
+
display: block;
|
|
23
|
+
max-width: 100%;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.heroInfo {
|
|
27
|
+
margin-left: 20px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.grid {
|
|
31
|
+
display: grid;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
padding: 20px;
|
|
34
|
+
gap: 20px;
|
|
35
|
+
grid-template-columns: 1fr;
|
|
36
|
+
|
|
37
|
+
style {
|
|
38
|
+
display: none;
|
|
39
|
+
visibility: hidden;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.cell {
|
|
43
|
+
position: absolute;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
background: transparent;
|
|
48
|
+
inset: 0;
|
|
49
|
+
object-fit: contain;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.cellLink {
|
|
53
|
+
position: relative;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
width: 100%;
|
|
56
|
+
height: 100svh;
|
|
57
|
+
margin: 0 auto;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
transform-origin: center;
|
|
60
|
+
transition: transform 0.3s ease;
|
|
61
|
+
|
|
62
|
+
&:hover {
|
|
63
|
+
transform: scale(1.05);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@media (min-width: 768px) {
|
|
68
|
+
grid-template-columns: repeat(2, 1fr);
|
|
69
|
+
|
|
70
|
+
.cellLink {
|
|
71
|
+
height: 66svh;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@media (min-width: 1400px) {
|
|
76
|
+
grid-template-columns: repeat(3, 1fr);
|
|
77
|
+
|
|
78
|
+
.cellLink {
|
|
79
|
+
height: 50svh;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/* stylelint-disable selector-class-pattern */
|
|
2
|
+
@import 'sanitize.css';
|
|
3
|
+
@import './theme.css';
|
|
4
|
+
@import '@micromag/core/assets/css/styles.css';
|
|
5
|
+
@import '@micromag/viewer/assets/css/styles.css';
|
|
6
|
+
@import '@micromag/consent/assets/css/styles.css';
|
|
7
|
+
|
|
8
|
+
html,
|
|
9
|
+
body {
|
|
10
|
+
overscroll-behavior: none;
|
|
11
|
+
overscroll-behavior-x: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
html, body, #app {
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
body {
|
|
20
|
+
background: var(--color-background, var(--color-black));
|
|
21
|
+
color: var(--color-text, var(--color-white));
|
|
22
|
+
font-family: var(--font-text);
|
|
23
|
+
font-size: 16px;
|
|
24
|
+
font-weight: 400;
|
|
25
|
+
overflow-y: scroll;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
h1,h2,h3,h4,h5,h6 {
|
|
29
|
+
font-family: var(--font-title);
|
|
30
|
+
font-weight: 700;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
p {
|
|
34
|
+
font-family: var(--font-text);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
strong {
|
|
38
|
+
font-weight: 700;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Hide scrollbar for IE, Edge and Firefox */
|
|
42
|
+
.hide-scrollbar {
|
|
43
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
44
|
+
scrollbar-width: none; /* Firefox */
|
|
45
|
+
|
|
46
|
+
&::-webkit-scrollbar {
|
|
47
|
+
display: none;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.modal-open {
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
padding-right: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.micromag-viewer-menus-menu-preview-title {
|
|
57
|
+
max-width: 100%;
|
|
58
|
+
font-family: Inter, Helvetica, arial, sans-serif;;
|
|
59
|
+
font-size: 20px;
|
|
60
|
+
font-weight: 400;
|
|
61
|
+
text-transform: uppercase;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.micromag-viewer-menus-menu-preview-titleContainer {
|
|
65
|
+
padding: 10px 20px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@media screen and (width >= 600px) {
|
|
69
|
+
.micromag-viewer-menus-menu-preview-title {
|
|
70
|
+
font-size: 24px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.micromag-viewer-menus-menu-preview-titleContainer {
|
|
74
|
+
padding: 10px 30px;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media screen and (width >= 1200px) {
|
|
79
|
+
.micromag-viewer-menus-menu-preview-title {
|
|
80
|
+
font-size: 28px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.micromag-viewer-menus-menu-preview-titleContainer {
|
|
84
|
+
padding: 10px 40px;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
|
|
6
|
+
.inner {
|
|
7
|
+
transition: opacity 0.2s ease-out;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.cookies {
|
|
11
|
+
position: absolute;
|
|
12
|
+
z-index: 2;
|
|
13
|
+
right: 15px;
|
|
14
|
+
bottom: 60px;
|
|
15
|
+
width: 30px;
|
|
16
|
+
height: 30px;
|
|
17
|
+
background-color: transparent;
|
|
18
|
+
color: #FFF;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.cookieIcon {
|
|
22
|
+
display: block;
|
|
23
|
+
max-width: 100%;
|
|
24
|
+
max-height: 100%;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MicromagStory } from '../types/micromag';
|
|
2
|
+
|
|
3
|
+
export default function addTrackingCodesToStory(story: MicromagStory, extraCodes: string[]) {
|
|
4
|
+
if (extraCodes.length <= 0 || story === null) {
|
|
5
|
+
return story;
|
|
6
|
+
}
|
|
7
|
+
const { settings = {} } = story;
|
|
8
|
+
const { tracking = {} } = settings || {};
|
|
9
|
+
const { codes = [] } = tracking || {};
|
|
10
|
+
return {
|
|
11
|
+
...story,
|
|
12
|
+
settings: {
|
|
13
|
+
...settings,
|
|
14
|
+
tracking: {
|
|
15
|
+
...tracking,
|
|
16
|
+
codes: [
|
|
17
|
+
...(codes || []),
|
|
18
|
+
...extraCodes.map((code) => ({
|
|
19
|
+
id: code,
|
|
20
|
+
type: 'ga4',
|
|
21
|
+
})),
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-props-no-spreading */
|
|
2
|
+
import MicromagConsent from '@micromag/consent';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import React, { useEffect, useCallback, useRef } from 'react';
|
|
5
|
+
|
|
6
|
+
import useKeyboardKeys, { KEYS } from '../../hooks/useKeyboardKeys';
|
|
7
|
+
|
|
8
|
+
import { useLocale } from '../../contexts/LocaleContext';
|
|
9
|
+
import { useModal } from '../../contexts/ModalContext';
|
|
10
|
+
|
|
11
|
+
import styles from '../../styles/modals/consent.module.css';
|
|
12
|
+
|
|
13
|
+
function Consent({ className = null }: { className?: string | null }) {
|
|
14
|
+
const modalRef = useRef(null);
|
|
15
|
+
const { modal = null, setModal, unsetModal } = useModal();
|
|
16
|
+
|
|
17
|
+
const onClose = useCallback(() => {
|
|
18
|
+
unsetModal();
|
|
19
|
+
setModal(null);
|
|
20
|
+
}, [setModal]);
|
|
21
|
+
|
|
22
|
+
const visible = modal !== null;
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (modal !== null) {
|
|
26
|
+
document.body.style.overflow = 'hidden';
|
|
27
|
+
} else {
|
|
28
|
+
document.body.style.overflow = '';
|
|
29
|
+
}
|
|
30
|
+
return () => {
|
|
31
|
+
document.body.style.overflow = '';
|
|
32
|
+
};
|
|
33
|
+
}, [modal]);
|
|
34
|
+
|
|
35
|
+
useKeyboardKeys({
|
|
36
|
+
[KEYS.ESCAPE]: onClose,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
className={classNames([
|
|
42
|
+
styles.container,
|
|
43
|
+
{
|
|
44
|
+
[styles.visible]: visible,
|
|
45
|
+
[className]: className !== null,
|
|
46
|
+
},
|
|
47
|
+
])}
|
|
48
|
+
>
|
|
49
|
+
<div className={styles.wrapper} ref={modalRef}>
|
|
50
|
+
<div className={styles.inner}>
|
|
51
|
+
<MicromagConsent
|
|
52
|
+
className={styles.consent}
|
|
53
|
+
onConfirm={onClose}
|
|
54
|
+
onClose={onClose}
|
|
55
|
+
/>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
<div className={styles.lightBox} />
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default Consent;
|