Skip to content

Commit 56ff2bb

Browse files
committed
FEATURE: cookie banner
1 parent 1c55537 commit 56ff2bb

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
prototype(Sfi.Site:CookieBanner) < prototype(Neos.Fusion:Component) {
2+
renderer.@process.style = ${'<style>
3+
.cross {
4+
position: absolute;
5+
top: 12px;
6+
right: 8px;
7+
}
8+
.CookieBanner {
9+
z-index: 1000;
10+
inset-block-start: auto;
11+
inset-block-end: 20px;
12+
background-color: #fff;
13+
border: none !important;
14+
box-shadow: 0 0 #0000, 0 0 #0000, 0 25px 50px -12px rgba(0, 0, 0, 0.25);
15+
padding: 24px;
16+
max-width: 400px;
17+
}
18+
</style>' + value}
19+
20+
renderer.@process.script = ${value + '<script>
21+
const dialog = document.querySelector(".js-cookieBanner");
22+
const closeDialogBtns = document.querySelectorAll(".js-closeDialog");
23+
24+
const closeDialog = (e) => {
25+
dialog.close();
26+
localStorage.setItem("cookieBannerDismissed", "true");
27+
};
28+
29+
closeDialogBtns.forEach(btn => {
30+
btn.addEventListener("click", closeDialog);
31+
});
32+
33+
dialog.addEventListener("cancel", closeDialog);
34+
35+
dialog.addEventListener("click", (e) => {
36+
if (e.target === dialog) {
37+
closeDialog();
38+
}
39+
});
40+
41+
if (!localStorage.getItem("cookieBannerDismissed")) {
42+
dialog.showModal();
43+
}
44+
</script>'}
45+
46+
47+
renderer = afx`
48+
<dialog class="CookieBanner js-cookieBanner" aria-labelledby="CookieBanner" aria-describedby="CookieBanner">
49+
<button class="cross js-closeDialog" tabindex="-1">
50+
<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
51+
<path d="M1 1L16 16" stroke="black"/>
52+
<path d="M16 1L0.999999 16" stroke="black"/>
53+
</svg>
54+
</button>
55+
<p class="ParagraphAlt textAlign-center paddingVertical-double">
56+
Мы используем cookie-файлы для улучшения пользовательского опыта и сбора статистики. Вы&nbsp;можете ознакомиться с нашей <a class="Link" href="https://psmb-neos-resources.hb.bizmrg.com/target/sfi/8a480d710e822b218bf799961082118574449eb8/%D0%9F%D0%BE%D0%BB%D0%B8%D1%82%D0%B8%D0%BA%D0%B0%20%D0%B8%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F%20cookies.pdf" target="_blank">Политикой использования cookie-файлов</a>.
57+
</p>
58+
<div class="flex flex-space-between">
59+
<button type="button" class="js-closeDialog Button" style="width: 100%; background-color: #ff8e18;">Понятно</button>
60+
</div>
61+
</dialog>
62+
`
63+
}

Packages/Sites/Sfi.Site/Resources/Private/Fusion/Root.fusion

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ prototype(Sfi.Site:Root) < prototype(Neos.Neos:Page) {
9393
contactPersonName = ${q(site).property('contactPersonName')}
9494
contactPersonPosition = ${q(site).property('contactPersonPosition')}
9595
contactPersonImage = ${q(site).property('contactPersonImage')}
96+
97+
cookieBanner = Sfi.Site:CookieBanner
9698
}
9799
}
98100

0 commit comments

Comments
 (0)