Skip to content

Commit

Permalink
Apply required changes to VKUI examples
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-medvedev-vk committed Oct 11, 2024
1 parent 1812193 commit 84d05ce
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions styleguide/Components/Frame/Frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { DOMContext } from '@vkui/lib/dom';
import { useLoadThemeTokens } from '../../lib/theme/useLoadThemeTokens';
import './Frame.css';

const FrameDomProvider = ({ platform, appearanceOptions, themeName, children }) => {
const FrameDomProvider = ({ appearanceOptions, themeName, children }) => {
const [ready, setReady] = React.useState(false);
const frame = useFrame();

Expand All @@ -29,7 +29,9 @@ const FrameDomProvider = ({ platform, appearanceOptions, themeName, children })
hotIconChange.observe(sprite, { characterData: true, childList: true });
hotObservers.push(hotIconChange);

frame.document.querySelector('.frame-content').setAttribute('id', 'root');
const frameContent = frame.document.querySelector('.frame-content');
frameContent.setAttribute('id', 'root');
frameContent.classList.add('vkui__root');

// Пихаем в iFrame vkui стили
const frameAssets = document.createDocumentFragment();
Expand Down Expand Up @@ -62,7 +64,7 @@ const FrameDomProvider = ({ platform, appearanceOptions, themeName, children })

const initialFrameContent = `
<!DOCTYPE html>
<html>
<html class="vkui">
<head>
<style>
#root {
Expand All @@ -75,19 +77,15 @@ const initialFrameContent = `
</html>
`;

export const Frame = ({ children, style, appearanceOptions, platform, themeName }) => {
export const Frame = ({ children, style, appearanceOptions, themeName }) => {
return (
<ReactFrame
mountTarget="body"
className="Frame"
style={style}
initialContent={initialFrameContent}
>
<FrameDomProvider
platform={platform}
appearanceOptions={appearanceOptions}
themeName={themeName}
>
<FrameDomProvider appearanceOptions={appearanceOptions} themeName={themeName}>
{children}
</FrameDomProvider>
</ReactFrame>
Expand Down

0 comments on commit 84d05ce

Please sign in to comment.