Skip to content

Commit

Permalink
Prevent flash of huge loading bar on suspense loaded routes
Browse files Browse the repository at this point in the history
  • Loading branch information
jb3 committed Jul 10, 2024
1 parent 00413b1 commit de5b5ec
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import AuthorizationSplash from "./components/AuthorizationSplash";

import { CSSTransition, TransitionGroup } from "react-transition-group";

import Logo from "./images/logo.svg";

import globalStyles from "./globalStyles";
import NotFound from "./pages/NotFound";

Expand All @@ -24,13 +26,22 @@ const routes = [
{ path: "/callback", Component: CallbackPage }
];

const pageLoadingStyles = css`
display: flex;
justify-content: center;
margin-top: 10%;
align-items: center;
flex-direction: column;
svg {
transform: scale(0.35);
}
`;

function PageLoading() {
return <div css={css`
display: flex;
justify-content: center;
margin-top: 50px;
`}>
<PropagateLoader color="white" size={100}/>
return <div css={pageLoadingStyles}>
<Logo/>
<PropagateLoader color="white"/>
</div>;
}

Expand Down
78 changes: 78 additions & 0 deletions src/images/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit de5b5ec

Please sign in to comment.