Skip to content

Commit 8ce335e

Browse files
committed
animate red cue on the phase tabs when removing them
1 parent b602fd4 commit 8ce335e

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/components/GenericMenu/GenericMenu.jsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import React from 'react'
22
import PT from 'prop-types'
3+
import cn from 'classnames'
34

45
import { NavLink } from 'react-router-dom'
6+
import { Transition } from 'react-transition-group'
57

68
import styles from './GenericMenu.scss'
79

@@ -12,7 +14,12 @@ const GenericMenu = ({
1214
<ul styleName="list">
1315
{!!navLinks && navLinks.map((item, i) => (
1416
<li key={i}>
15-
{item.hasNotifications && <i styleName="dot" />}
17+
{/* `timeout` should be same as `.dot` transition duration in CSS */}
18+
<Transition in={item.hasNotifications} timeout={1000} unmountOnExit>
19+
{
20+
state => <i className={cn(styles['dot'], styles[state])} />
21+
}
22+
</Transition>
1623
{item.to
1724
? <NavLink to={item.to} activeClassName={styles.active} exact>{item.label}</NavLink>
1825
: <span onClick={item.onClick} styleName={item.isActive ? 'active' : ''}>{item.label}</span>

src/components/GenericMenu/GenericMenu.scss

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
position: relative;
1818
line-height: 50px;
1919
margin: 0 20px;
20-
.dot {
20+
.dot {
21+
opacity: 1;
22+
transition: opacity 1000ms ease-in-out; // duration should be same as Transition `timeout`
2123
position: absolute;
2224
right: -12px;
2325
top: 10px;
@@ -26,6 +28,11 @@
2628
border-radius: 100%;
2729
background-color: $tc-red-70;
2830
}
31+
32+
.dot.exiting,
33+
.dot.exited {
34+
opacity: 0;
35+
}
2936
}
3037
a,
3138
span {

0 commit comments

Comments
 (0)