From 45255c3c15ee967434c149d5148dfbcb8c187b62 Mon Sep 17 00:00:00 2001 From: imrishabh18 Date: Sat, 26 Apr 2025 15:52:45 +0530 Subject: [PATCH] add skeleton until the iframe is loaded --- src/components/TscircuitIframe.tsx | 17 ++++++++++++- src/css/custom.css | 40 ++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/components/TscircuitIframe.tsx b/src/components/TscircuitIframe.tsx index 2de9d6a0..f3e29a38 100644 --- a/src/components/TscircuitIframe.tsx +++ b/src/components/TscircuitIframe.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef } from "react" +import { useEffect, useRef, useState } from "react" export interface TscircuitIframeProps { fsMap?: Record @@ -8,6 +8,7 @@ export interface TscircuitIframeProps { export const TscircuitIframe = (runFrameProps: TscircuitIframeProps) => { const iframeRef = useRef(null) + const [isLoading, setIsLoading] = useState(true) let additionalProps = {} @@ -29,6 +30,7 @@ export const TscircuitIframe = (runFrameProps: TscircuitIframeProps) => { }, "*", ) + setIsLoading(false) } } @@ -38,6 +40,14 @@ export const TscircuitIframe = (runFrameProps: TscircuitIframeProps) => { return (
+ {isLoading && ( +
+
+
+
+
+
+ )}