File tree 2 files changed +27
-37
lines changed
2 files changed +27
-37
lines changed Original file line number Diff line number Diff line change 1
1
import App , { Container } from 'next/app' ;
2
2
import React from 'react' ;
3
- import { TransitionGroup , CSSTransition } from 'react-transition-group' ;
3
+ import styled from 'styled-components' ;
4
+ import { Transition } from 'react-spring' ;
4
5
import AppNavigation from '../components/AppNavigation' ;
5
6
import AppFooter from '../components/AppFooter' ;
6
7
import data from '../tools/data' ;
@@ -57,22 +58,33 @@ export default class MyApp extends App {
57
58
changeUser = { this . changeUser }
58
59
pathname = { this . props . router . pathname }
59
60
/>
60
- < TransitionGroup className = "transition-group-wrapper" >
61
- < CSSTransition
62
- classNames = "page"
63
- key = { this . props . router . pathname }
64
- timeout = { 250 }
65
- >
66
- < Component
67
- { ...pageProps }
68
- { ...this . state }
69
- selectedUser = { selectedUser }
70
- />
71
- </ CSSTransition >
72
- </ TransitionGroup >
73
- < AppFooter />
61
+ < Transition
62
+ from = { { opacity : 0 } }
63
+ enter = { { opacity : 1 } }
64
+ leave = { { opacity : 0 } }
65
+ keys = { this . props . router . route }
66
+ >
67
+ { style => (
68
+ < Positioner style = { style } >
69
+ < Component
70
+ { ...pageProps }
71
+ { ...this . state }
72
+ selectedUser = { selectedUser }
73
+ />
74
+ < AppFooter />
75
+ </ Positioner >
76
+ ) }
77
+ </ Transition >
74
78
</ div >
75
79
</ Container >
76
80
) ;
77
81
}
78
82
}
83
+
84
+ const Positioner = styled . div `
85
+ position: absolute;
86
+ display: flex;
87
+ flex-direction: column;
88
+ align-items: center;
89
+ width: 100%;
90
+ ` ;
Original file line number Diff line number Diff line change @@ -46,26 +46,4 @@ injectGlobal`
46
46
font-family: 'Playfair Display', serif;
47
47
font-weight: normal;
48
48
}
49
-
50
- .transition-group-wrapper {
51
- position: relative; /* xavier's dirty hack */
52
- }
53
-
54
- .page-enter,
55
- .page-exit {
56
- opacity: 0;
57
- transition: all 0.25s ease;
58
- }
59
-
60
- .page-enter-active,
61
- .page-exit-active {
62
- transition: all 0.25s ease;
63
- transform: translateZ(0);
64
- backface-visibility: hidden;
65
- }
66
-
67
- .page-enter-active {
68
- opacity: 1;
69
- position: absolute; /* xavier's dirty hack */
70
- }
71
49
` ;
You can’t perform that action at this time.
0 commit comments