main
parent
ba61cd083f
commit
19e391c2c2
|
@ -20,28 +20,6 @@ export default function Examples(props: { dict: Record<string, string>; lang: st
|
|||
fetchData();
|
||||
}, []);
|
||||
|
||||
const [progress, setProgress] = useState(0);
|
||||
|
||||
const timer = useRef<NodeJS.Timeout>();
|
||||
useEffect(() => {
|
||||
if (previewInfo.preview) {
|
||||
setProgress(0);
|
||||
timer.current = setInterval(() => {
|
||||
if (progress === 100) {
|
||||
clearInterval(timer.current);
|
||||
return;
|
||||
}
|
||||
setProgress((prevProgress) => {
|
||||
if (prevProgress >= 90) {
|
||||
clearInterval(timer.current);
|
||||
return 90;
|
||||
}
|
||||
return prevProgress + 10;
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
}, [previewInfo.preview]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="w-[96%] flex flex-wrap mt-[34px] mb-[83px] mx-auto">
|
||||
|
@ -92,8 +70,7 @@ export default function Examples(props: { dict: Record<string, string>; lang: st
|
|||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
{progress < 90 && <div className="text-red-500 font-bold text-3xl text-center absolute z-[30]">{progress}%</div>}
|
||||
>1
|
||||
<iframe src={previewInfo.url} className="w-full h-full" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue