File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
packages/overmind-website/src/components/App Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -20,15 +20,18 @@ const pages = {
2020 [ Page . VIDEOS ] : Videos ,
2121}
2222
23- const fadeInPage = ( ) => {
24- const el = document . querySelector ( '#overmind-app' ) as HTMLElement
25- const logo = document . querySelector ( '#overmind-loader' ) as HTMLElement
26- el . style . backgroundColor = 'rgb(250,250,250)'
27- el . style . opacity = '1'
28- logo . addEventListener ( 'transitionend' , ( ) => {
29- logo . style . display = 'none'
23+ const fadeInPage = ( cb : ( ) => void ) => {
24+ requestAnimationFrame ( ( ) => {
25+ const el = document . querySelector ( '#overmind-app' ) as HTMLElement
26+ const logo = document . querySelector ( '#overmind-loader' ) as HTMLElement
27+ el . style . backgroundColor = 'rgb(250,250,250)'
28+ el . style . opacity = '1'
29+ logo . addEventListener ( 'transitionend' , ( ) => {
30+ logo . style . display = 'none'
31+ } )
32+ logo . style . opacity = '0'
33+ cb ( )
3034 } )
31- logo . style . opacity = '0'
3235}
3336
3437const App : SFC = ( ) => {
@@ -37,8 +40,9 @@ const App: SFC = () => {
3740 const isMobile = useIsMobile ( )
3841 useScrollToPosition ( state . page )
3942 useEffect ( ( ) => {
40- fadeInPage ( )
41- mainRef . current . style . opacity = '1'
43+ fadeInPage ( ( ) => {
44+ mainRef . current . style . opacity = '1'
45+ } )
4246 } , [ ] )
4347
4448 if ( ! state . page ) {
You can’t perform that action at this time.
0 commit comments