From 19b48b20fef89794a950c12d7818954770d9cd92 Mon Sep 17 00:00:00 2001 From: zerosoul Date: Wed, 8 Jun 2022 11:28:22 +0800 Subject: [PATCH] refactor: loading for suspend --- src/common/component/Loading.js | 12 ++++-- src/routes/home/index.js | 2 +- src/routes/index.js | 71 ++++++++++++++++++++++++++++----- 3 files changed, 71 insertions(+), 14 deletions(-) diff --git a/src/common/component/Loading.js b/src/common/component/Loading.js index 9948a2c2..781eb52e 100644 --- a/src/common/component/Loading.js +++ b/src/common/component/Loading.js @@ -13,13 +13,17 @@ opacity: 1; } `; const StyledWrapper = styled.div` - width: 100vw; - height: 100vh; + width: 100%; + height: 100%; display: flex; flex-direction: column; gap: 15px; align-items: center; justify-content: center; + &.fullscreen { + width: 100vw; + height: 100vh; + } .loading { display: flex; align-items: center; @@ -33,14 +37,14 @@ const StyledWrapper = styled.div` } } `; -export default function Loading({ reload = false }) { +export default function Loading({ reload = false, fullscreen = false }) { const { clearLocalData } = useLogout(); const handleReload = () => { clearLocalData(); location.reload(true); }; return ( - + ; + return ; } const isSettingPage = pathname.startsWith("/setting"); if (isSettingPage) { diff --git a/src/routes/index.js b/src/routes/index.js index 7d051f26..6bc6045a 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -45,7 +45,7 @@ const PageRoutes = () => { return ( - }> + }> } /> { } > - } /> + }> + + + } + /> } /> - } /> + }> + + + } + /> } /> - } /> - } /> + }> + + + } + /> + }> + + + } + /> - } /> - } /> + }> + + + } + /> + }> + + + } + /> - }> + }> + + + } + > } + element={ + }> + + + } > } />