From 93526b70452370c1359653fc216345a59e750c2b Mon Sep 17 00:00:00 2001 From: Nik Tverd Date: Fri, 22 Dec 2023 12:14:16 +0600 Subject: [PATCH] fixup! fixup! feat: update a way params are thrown to iframe styles --- src/components/Media/Iframe/Iframe.tsx | 10 +++++----- src/components/Media/__stories__/Media.stories.tsx | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/Media/Iframe/Iframe.tsx b/src/components/Media/Iframe/Iframe.tsx index 72d3c2eba..0b4cfef6b 100644 --- a/src/components/Media/Iframe/Iframe.tsx +++ b/src/components/Media/Iframe/Iframe.tsx @@ -1,4 +1,4 @@ -import React, {useCallback, useEffect, useRef, useState} from 'react'; +import React, {useCallback, useEffect, useRef} from 'react'; import {v4 as uuidv4} from 'uuid'; @@ -17,9 +17,9 @@ const Iframe = (props: MediaComponentIframeProps) => { const formContainerRef = useRef(null); const iframeRef = useRef(); - const [iframeId] = useState(uuidv4()); + const iframeId = uuidv4(); - const updateFormIframe = useCallback( + const updateIframe = useCallback( (container: HTMLDivElement) => { if (iframeRef.current) { iframeRef.current.src = src; @@ -81,10 +81,10 @@ const Iframe = (props: MediaComponentIframeProps) => { const container = formContainerRef.current; if (container) { - updateFormIframe(container); + updateIframe(container); window.addEventListener('message', handleMessage, {passive: true}); } - }, [updateFormIframe, handleMessage]); + }, [updateIframe, handleMessage]); useEffect(() => { addIframe(); diff --git a/src/components/Media/__stories__/Media.stories.tsx b/src/components/Media/__stories__/Media.stories.tsx index e15f5a9d9..9e7bb0554 100644 --- a/src/components/Media/__stories__/Media.stories.tsx +++ b/src/components/Media/__stories__/Media.stories.tsx @@ -20,8 +20,6 @@ const DefaultTemplate: StoryFn = (args) => ( const IframeTemplate: StoryFn = (args) => (
-

Iframe with margins (default)

-

Iframe without margins