Skip to content

Commit

Permalink
Merge pull request #576 from ipavlenko/fix/MINT-1158-ui-fixes
Browse files Browse the repository at this point in the history
MINT-1158 Drawer (double click) on CBE pages fixed
  • Loading branch information
ipavlenko committed Feb 20, 2018
2 parents 1f53eb1 + 08cb06b commit 0478d7a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/layouts/partials/DrawerPartial/DrawerPartial.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Translate } from 'react-redux-i18n'
import classnames from 'classnames'
import { connect } from 'react-redux'
import menu from 'menu'
import { drawerToggle } from 'redux/drawer/actions'
import { drawerToggle, drawerHide } from 'redux/drawer/actions'
import { logout } from 'redux/session/actions'
import styles from '../styles'

Expand All @@ -18,14 +18,7 @@ export default class DrawerPartial extends PureComponent {
isDrawerOpen: PropTypes.bool,
isCBE: PropTypes.bool,
handleDrawerToggle: PropTypes.func,
}

constructor (props) {
super(props)

this.state = {
isOpened: false,
}
handleDrawerHide: PropTypes.func,
}

render () {
Expand Down Expand Up @@ -67,7 +60,7 @@ export default class DrawerPartial extends PureComponent {
innerDivStyle={styles.drawer.item.innerDivStyle}
disabled={item.disabled}
primaryText={<Translate value={item.title} />}
onTouchTap={this.props.handleDrawerToggle}
onTouchTap={this.props.handleDrawerHide}
leftIcon={
<FontIcon
style={item.disabled ? styles.drawer.item.iconStyleDisabled : styles.drawer.item.iconStyle}
Expand All @@ -80,7 +73,6 @@ export default class DrawerPartial extends PureComponent {
styleName='item'
activeClassName='drawer-item-active'
to={{ pathname: item.path }}
stopPropagation
/>
: <div />
}
Expand All @@ -99,6 +91,7 @@ function mapStateToProps (state) {
function mapDispatchToProps (dispatch) {
return {
handleDrawerToggle: () => dispatch(drawerToggle()),
handleDrawerHide: () => dispatch(drawerHide()),
handleLogout: () => dispatch(logout()),
}
}
4 changes: 4 additions & 0 deletions src/redux/drawer/actions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// TODO @ipavlenko: Implement a DrawerStack if there will be more than 1 drower
export const DRAWER_TOGGLE = 'drawer/TOGGLE'
export const DRAWER_HIDE = 'drawer/HIDE'

export const drawerToggle = () => (dispatch) => {
dispatch({ type: DRAWER_TOGGLE })
}
export const drawerHide = () => (dispatch) => {
dispatch({ type: DRAWER_HIDE })
}
5 changes: 5 additions & 0 deletions src/redux/drawer/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export default (state = initialState, action) => {
...action.payload,
isOpen: !state.isOpen,
}
case actions.DRAWER_HIDE:
return {
...action.payload,
isOpen: false,
}
default:
return state
}
Expand Down

0 comments on commit 0478d7a

Please sign in to comment.