-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(app): improve loading experience during navigation (#204)
- Loading branch information
1 parent
080245e
commit 136b127
Showing
3 changed files
with
58 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
import * as React from 'react'; | ||
import Island from '../resources/Island.svg'; | ||
|
||
export const Loader = () => { | ||
export const LoaderViews = { | ||
FULL_SCREEN: 'FULL_SCREEN', | ||
PARTIAL: 'PARTIAL' | ||
} as const; | ||
type View = keyof typeof LoaderViews; | ||
|
||
export const Loader = ({ view }: { view: View }) => { | ||
return ( | ||
<div className="flex min-h-screen items-center justify-center"> | ||
<div className={`flex items-center justify-center ${getViewClass(view)}`}> | ||
<img className="w-1/6 animate-pulse" src={Island} alt="comparadise-loader" /> | ||
</div> | ||
); | ||
}; | ||
|
||
const getViewClass = (view: View) => { | ||
switch (view) { | ||
case LoaderViews.FULL_SCREEN: | ||
return 'min-h-screen'; | ||
case LoaderViews.PARTIAL: | ||
return 'mt-48'; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters