File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 11import React from 'react'
22import PT from 'prop-types'
3+ import cn from 'classnames'
34
45import { NavLink } from 'react-router-dom'
6+ import { Transition } from 'react-transition-group'
57
68import 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 >
Original file line number Diff line number Diff line change 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 ;
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 {
You can’t perform that action at this time.
0 commit comments