1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2024-12-27 02:43:54 +02:00

DCS Layout

This commit is contained in:
Anton 2024-10-09 20:52:28 +03:00
parent a7c301c6d5
commit 829ae9a5de
4 changed files with 59 additions and 23 deletions

1
.gitignore vendored
View File

@ -15,3 +15,4 @@ fakedata.json
/build
/docs/docusaurus/.docusaurus
/docs/docusaurus/build
/docs/docusaurus/docs

View File

@ -34,17 +34,6 @@ const config = {
locales: ['ru'],
},
scripts: [
{
src: 'https://openintegrations.dev/js/yads.js',
defer: true
},
{
src: 'https://yandex.ru/ads/system/context.js',
async: true
}
],
presets: [
[
'classic',
@ -85,6 +74,21 @@ const config = {
}
},
customFields: {
yandexAdsBlock: `
<div id="yandex_rtb_R-A-12294791-1"></div>
<script>
window.yaContextCb.push(() => {
Ya.Context.AdvManager.render({
"blockId": "R-A-12294791-1",
"renderTo": "yandex_rtb_R-A-12294791-1",
"type": "feed"
})
})
</script>
`,
},
colorMode: {
defaultMode: 'light',
disableSwitch: true,

View File

@ -1,12 +0,0 @@
import React from 'react';
import Footer from '@theme-original/Footer';
export default function FooterWrapper(props) {
return (
<>
<div style={{height:150 + 'px'}} id="yandex_rtb_R-A-12294791-1"></div>
<Footer {...props} />
</>
);
}

View File

@ -0,0 +1,43 @@
import React, { useEffect } from 'react';
import Layout from '@theme-original/Layout';
import Head from '@docusaurus/Head';
export default function CustomLayout(props) {
useEffect(() => {
// Создаем <div> для блока Яндекса в конце body
const adDiv = document.createElement('div');
adDiv.id = 'yandex_rtb_R-A-12294791-1';
document.body.appendChild(adDiv);
// Добавляем скрипт для отображения рекламы
const script = document.createElement('script');
script.innerHTML = `
window.yaContextCb.push(() => {
Ya.Context.AdvManager.render({
blockId: "R-A-12294791-1",
renderTo: "yandex_rtb_R-A-12294791-1",
type: "feed"
});
});
`;
document.body.appendChild(script);
// Удаляем элементы при размонтировании компонента
return () => {
document.body.removeChild(adDiv);
document.body.removeChild(script);
};
}, []);
return (
<>
<Head>
<script>
window.yaContextCb = window.yaContextCb || [];
</script>
<script src="https://yandex.ru/ads/system/context.js" async></script>
</Head>
<Layout {...props} />
</>
);
}