Skip to content

Commit 8f075a9

Browse files
committed
Add a demo where height transition is detailed until after leave.
1 parent aa09e81 commit 8f075a9

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

demo/assets/transitions.css

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,33 @@
2424

2525
/* Fade out, then fade in transition */
2626

27-
.fade-wait-leave {
27+
.fade-wait-leave,
28+
.fade-wait-delay-leave {
2829
opacity: 1;
2930
}
30-
.fade-wait-leave.fade-wait-leave-active {
31+
.fade-wait-leave.fade-wait-leave-active,
32+
.fade-wait-delay-leave.fade-wait-delay-leave-active {
3133
opacity: 0;
3234
transition: opacity .4s ease-in;
3335
}
3436

35-
.fade-wait-enter {
37+
.fade-wait-enter,
38+
.fade-wait-delay-enter {
3639
opacity: 0;
3740
}
38-
.fade-wait-enter.fade-wait-enter-active {
41+
.fade-wait-enter.fade-wait-enter-active,
42+
.fade-wait-delay-enter.fade-wait-delay-enter-active {
3943
opacity: 1;
4044
/* Delay the enter animation until the leave completes */
41-
transition: opacity .4s ease-in .6s;
45+
transition: opacity .4s ease-in .4s;
4246
}
4347

4448
.fade-wait-height {
45-
transition: height .6s ease-in-out;
49+
transition: height .8s ease-in-out;
50+
}
51+
.fade-wait-delay-height {
52+
/* Delay the height animation until the leave completes */
53+
transition: height .4s ease-in-out .4s;
4654
}
4755

4856

demo/components/Demo.jsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,24 @@ class Demo extends React.Component {
5656
</ContentSwapper>
5757

5858
<h3 id="fade-wait">Fade out, then fade in transition</h3>
59-
<p>The <code>opacity</code> transition for <code>enter</code> animation is delayed until after
60-
the <code>leave</code> transition completes. View the <a
59+
<p>For the first paragraph the <code>opacity</code> transition for <code>enter</code> animation is delayed
60+
until after the <code>leave</code> transition completes. View the <a
6161
href="https://github.com/marnusw/react-css-transition-replace#fade-out-then-fade-in"
62-
target="_blank">CSS</a>.</p>
62+
target="_blank">CSS</a>.<br/>For the second paragraph both the enter and height transitions
63+
are delayed.</p>
6364

6465
<ContentSwapper transitionName="fade-wait" transitionEnterTimeout={1000} transitionLeaveTimeout={400}>
6566
<ContentLong key="long"/>
6667
<ContentShort key="short"/>
6768
</ContentSwapper>
6869

70+
<br/>
71+
72+
<ContentSwapper transitionName="fade-wait-delay" transitionEnterTimeout={1000} transitionLeaveTimeout={400}>
73+
<ContentLong key="long"/>
74+
<ContentShort key="short"/>
75+
</ContentSwapper>
76+
6977
<h3 id="carousel-swap">Carousel transition</h3>
7078
<p>The slide animation is realised with a 2D CSS <code>transform</code>. View the <a
7179
href="transitions.css" target="_blank">CSS source</a>. To ensure the entering/leaving

0 commit comments

Comments
 (0)