1
1
import React from 'react' ;
2
2
import { Navbar , NavBrand , Nav , NavItem , Grid } from 'react-bootstrap' ;
3
3
4
+ import PageHead from './PageHead.jsx' ;
4
5
import ContentSwapper from './ContentSwapper.jsx' ;
5
6
6
7
import ContentLong from './ContentLong.jsx' ;
@@ -10,10 +11,10 @@ class Demo extends React.Component {
10
11
11
12
componentDidMount ( ) {
12
13
const images = [
13
- '/ img/vista1.jpg' ,
14
- '/ img/vista2.jpg' ,
15
- '/ img/vista3.jpg' ,
16
- '/ img/vista4.jpg'
14
+ 'img/vista1.jpg' ,
15
+ 'img/vista2.jpg' ,
16
+ 'img/vista3.jpg' ,
17
+ 'img/vista4.jpg'
17
18
] ;
18
19
19
20
images . forEach ( src => {
@@ -33,28 +34,48 @@ class Demo extends React.Component {
33
34
</ Navbar >
34
35
35
36
< Grid >
36
- < br />
37
- < p className = "text-danger" > < em > Click any content to trigger the transition.</ em > </ p >
38
-
39
- < h2 > Cross-fade transition</ h2 >
40
- < ContentSwapper transitionName = "cross-fade" transitionEnterTimeout = { 1000 } transitionLeaveTimeout = { 1000 } >
41
- < img key = "img1" src = "/img/vista1.jpg" width = "600" height = "235" />
42
- < img key = "img2" src = "/img/vista2.jpg" width = "600" height = "280" />
43
- </ ContentSwapper >
44
-
45
- < h2 > Fade out, then fade in transition</ h2 >
46
- < ContentSwapper transitionName = "fade-wait" transitionEnterTimeout = { 1000 } transitionLeaveTimeout = { 400 } >
47
- < ContentLong key = "long" />
48
- < ContentShort key = "short" />
49
- </ ContentSwapper >
50
-
51
- < h2 > Carousel transition</ h2 >
52
- < ContentSwapper transitionName = "carousel-swap" transitionEnterTimeout = { 500 } transitionLeaveTimeout = { 500 }
53
- style = { { width : 600 } } >
54
- < img key = "img3" src = "/img/vista3.jpg" width = "600" height = "255" />
55
- < img key = "img4" src = "/img/vista4.jpg" width = "600" height = "280" />
56
- </ ContentSwapper >
37
+ < PageHead />
57
38
39
+ < div className = "examples" >
40
+ < h2 > Examples</ h2 >
41
+ < p className = "text-danger" > < em > Click any content to trigger the transition.</ em > </ p >
42
+
43
+ < h3 > Cross-fade transition</ h3 >
44
+ < p > The < code > opacity</ code > transitions for < code > enter</ code > and < code > leave</ code > are started
45
+ at the same time. View the < a
46
+ href = "https://github.com/marnusw/react-css-transition-replace#cross-fading-two-components"
47
+ target = "_blank" > CSS</ a > .</ p >
48
+
49
+ < ContentSwapper transitionName = "cross-fade" transitionEnterTimeout = { 1000 } transitionLeaveTimeout = { 1000 } >
50
+ < img key = "img1" src = "img/vista1.jpg" width = "600" height = "235" />
51
+ < img key = "img2" src = "img/vista2.jpg" width = "600" height = "280" />
52
+ </ ContentSwapper >
53
+
54
+ < h3 > Fade out, then fade in transition</ h3 >
55
+ < p > The < code > opacity</ code > transitions for < code > enter</ code > animation is delayed until after
56
+ the < code > leave</ code > transition completes. View the < a
57
+ href = "https://github.com/marnusw/react-css-transition-replace#fade-out-then-fade-in"
58
+ target = "_blank" > CSS</ a > .</ p >
59
+
60
+ < ContentSwapper transitionName = "fade-wait" transitionEnterTimeout = { 1000 } transitionLeaveTimeout = { 400 } >
61
+ < ContentLong key = "long" />
62
+ < ContentShort key = "short" />
63
+ </ ContentSwapper >
64
+
65
+ < h3 > Carousel transition</ h3 >
66
+ < p > The slide animation is realised with a 2D CSS < code > transform</ code > . View the < a
67
+ href = "transitions.css" target = "_blank" > CSS source</ a > . To ensure the entering/leaving
68
+ images are properly hidden the carousel width can be set directly on the container:
69
+ < code > { '<ReactCSSTransitionReplace transitionName="carousel-swap" /*...*/ style={{width: 600}}>' } </ code > .
70
+ </ p >
71
+
72
+ < ContentSwapper transitionName = "carousel-swap" transitionEnterTimeout = { 500 } transitionLeaveTimeout = { 500 }
73
+ style = { { width : 600 } } >
74
+ < img key = "img3" src = "img/vista3.jpg" width = "600" height = "255" />
75
+ < img key = "img4" src = "img/vista4.jpg" width = "600" height = "280" />
76
+ </ ContentSwapper >
77
+
78
+ </ div >
58
79
</ Grid >
59
80
</ div >
60
81
) ;
0 commit comments