فهرست منبع

hide loading under 500ms

AykutSarac 2 سال پیش
والد
کامیت
ff248f041f
2فایلهای تغییر یافته به همراه15 افزوده شده و 1 حذف شده
  1. 1 0
      src/components/Graph/index.tsx
  2. 14 1
      src/components/Loading/index.tsx

+ 1 - 0
src/components/Graph/index.tsx

@@ -111,6 +111,7 @@ const GraphComponent = ({ isWidget, openModal, setSelectedNode }: LayoutProps) =
             width: "100%",
             width: "100%",
             height: "100%",
             height: "100%",
             overflow: "hidden",
             overflow: "hidden",
+            display: loading ? "none" : "block"
           }}
           }}
         >
         >
           <Canvas
           <Canvas

+ 14 - 1
src/components/Loading/index.tsx

@@ -1,10 +1,19 @@
 import React from "react";
 import React from "react";
-import styled from "styled-components";
+import styled, { keyframes } from "styled-components";
 
 
 interface LoadingProps {
 interface LoadingProps {
   message?: string;
   message?: string;
 }
 }
 
 
+const fadeIn = keyframes`
+ 99% {
+    visibility: hidden;
+  }
+  100% {
+    visibility: visible;
+  }
+`;
+
 const StyledLoading = styled.div`
 const StyledLoading = styled.div`
   position: fixed;
   position: fixed;
   top: 0;
   top: 0;
@@ -17,6 +26,10 @@ const StyledLoading = styled.div`
   background: ${({ theme }) => theme.BLACK_DARK};
   background: ${({ theme }) => theme.BLACK_DARK};
   z-index: 36;
   z-index: 36;
   pointer-events: none;
   pointer-events: none;
+  animation: 0.5s ${fadeIn};
+  animation-fill-mode: forwards;
+
+  visibility: hidden;
 `;
 `;
 
 
 const StyledLogo = styled.h2`
 const StyledLogo = styled.h2`