Refactor(Variable): Optimize variable name

This commit is contained in:
2024-05-06 15:37:45 +08:00
parent 5e6c8f214c
commit 779e0ab2c0
28 changed files with 194 additions and 193 deletions

View File

@@ -42,7 +42,7 @@ const iframeUrl = getIframeUrl(iframeRaw)
const Render = ({ iframeKey, compiledCode, mobileMode = false }: RenderProps) => {
const iframeRef = useRef<HTMLIFrameElement>(null)
const [loaded, setLoaded] = useState(false)
const [isLoaded, setIsLoaded] = useState(false)
const [selectedDevice, setSelectedDevice] = useState('Pixel 7')
const [zoom, setZoom] = useState(1)
const [isRotate, setIsRotate] = useState(false)
@@ -148,7 +148,7 @@ const Render = ({ iframeKey, compiledCode, mobileMode = false }: RenderProps) =>
}
useEffect(() => {
if (loaded) {
if (isLoaded) {
iframeRef.current?.contentWindow?.postMessage(
{
type: 'UPDATE',
@@ -157,10 +157,10 @@ const Render = ({ iframeKey, compiledCode, mobileMode = false }: RenderProps) =>
'*'
)
}
}, [loaded, compiledCode])
}, [isLoaded, compiledCode])
useEffect(() => {
if (loaded) {
if (isLoaded) {
iframeRef.current?.contentWindow?.postMessage(
{
type: 'SCALE',
@@ -169,7 +169,7 @@ const Render = ({ iframeKey, compiledCode, mobileMode = false }: RenderProps) =>
'*'
)
}
}, [loaded, zoom])
}, [isLoaded, zoom])
return mobileMode ? (
<>
@@ -202,7 +202,7 @@ const Render = ({ iframeKey, compiledCode, mobileMode = false }: RenderProps) =>
key={iframeKey}
ref={iframeRef}
src={iframeUrl}
onLoad={() => setLoaded(true)}
onLoad={() => setIsLoaded(true)}
sandbox="allow-downloads allow-forms allow-modals allow-scripts"
/>
</div>
@@ -244,7 +244,7 @@ const Render = ({ iframeKey, compiledCode, mobileMode = false }: RenderProps) =>
key={iframeKey}
ref={iframeRef}
src={iframeUrl}
onLoad={() => setLoaded(true)}
onLoad={() => setIsLoaded(true)}
sandbox="allow-downloads allow-forms allow-modals allow-scripts"
/>
)