@@ -3,6 +3,7 @@ import { Navbar, NavBrand, Nav, NavItem, Grid } from 'react-bootstrap';
3
3
4
4
import PageHead from './PageHead.jsx' ;
5
5
import ContentSwapper from './ContentSwapper.jsx' ;
6
+ import ContentAddRemove from './ContentAddRemove.jsx' ;
6
7
7
8
import ContentLong from './ContentLong.jsx' ;
8
9
import ContentShort from './ContentShort.jsx' ;
@@ -40,7 +41,7 @@ class Demo extends React.Component {
40
41
< h2 > Examples</ h2 >
41
42
< p className = "text-danger" > < em > Click any content to trigger the transition.</ em > </ p >
42
43
43
- < h3 > Cross-fade transition</ h3 >
44
+ < h3 id = "cross-fade" > Cross-fade transition</ h3 >
44
45
< p > The < code > opacity</ code > transitions for < code > enter</ code > and < code > leave</ code > are started
45
46
at the same time. View the < a
46
47
href = "https://github.com/marnusw/react-css-transition-replace#cross-fading-two-components"
@@ -51,8 +52,8 @@ class Demo extends React.Component {
51
52
< img key = "img2" src = "img/vista2.jpg" width = "600" height = "280" />
52
53
</ ContentSwapper >
53
54
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
55
+ < h3 id = "fade-wait" > Fade out, then fade in transition</ h3 >
56
+ < p > The < code > opacity</ code > transition for < code > enter</ code > animation is delayed until after
56
57
the < code > leave</ code > transition completes. View the < a
57
58
href = "https://github.com/marnusw/react-css-transition-replace#fade-out-then-fade-in"
58
59
target = "_blank" > CSS</ a > .</ p >
@@ -62,7 +63,7 @@ class Demo extends React.Component {
62
63
< ContentShort key = "short" />
63
64
</ ContentSwapper >
64
65
65
- < h3 > Carousel transition</ h3 >
66
+ < h3 id = "carousel-swap" > Carousel transition</ h3 >
66
67
< p > The slide animation is realised with a 2D CSS < code > transform</ code > . View the < a
67
68
href = "transitions.css" target = "_blank" > CSS source</ a > . To ensure the entering/leaving
68
69
images are properly hidden the carousel width can be set directly on the container:
@@ -75,6 +76,17 @@ class Demo extends React.Component {
75
76
< img key = "img4" src = "img/vista4.jpg" width = "600" height = "280" />
76
77
</ ContentSwapper >
77
78
79
+ < h3 id = "roll-up" > Add/Remove Content</ h3 >
80
+ < p > The child component may be removed (i.e. < code > ReactCSSTransitionReplace</ code > left with no children)
81
+ which will animate the < code > height</ code > going to zero along with the < code > leave</ code > transition.
82
+ A single child can subsequently be added again, triggering the inverse animation.
83
+ View the < a href = "transitions.css" target = "_blank" > CSS source</ a > of the `roll-up` transition.
84
+ </ p >
85
+
86
+ < ContentAddRemove transitionName = "roll-up" transitionEnterTimeout = { 800 } transitionLeaveTimeout = { 800 } >
87
+ < img key = "img1" src = "img/vista1.jpg" width = "600" height = "235" />
88
+ </ ContentAddRemove >
89
+
78
90
</ div >
79
91
</ Grid >
80
92
</ div >
0 commit comments