mirror of
https://github.com/yldio/copilot.git
synced 2024-12-01 07:30:07 +02:00
adding in off-click of element handler
This commit is contained in:
parent
08acbe5944
commit
017f133611
@ -76,14 +76,22 @@ const arrowPosition = {
|
||||
right: '10%'
|
||||
};
|
||||
|
||||
const Header = ({
|
||||
account = {},
|
||||
tooltip = false,
|
||||
handleToggle
|
||||
}) => {
|
||||
const Header = (props) => {
|
||||
|
||||
const {
|
||||
account,
|
||||
handleToggle,
|
||||
tooltip
|
||||
} = props;
|
||||
|
||||
const handleToggleClick = (ev) => {
|
||||
ev.preventDefault();
|
||||
handleToggle();
|
||||
handleToggle(!tooltip);
|
||||
};
|
||||
|
||||
const handleHideToggle = (ev) => {
|
||||
ev.preventDefault();
|
||||
handleToggle(false);
|
||||
};
|
||||
|
||||
const tooltipComponent = !tooltip ? null : (
|
||||
@ -103,7 +111,11 @@ const Header = ({
|
||||
);
|
||||
|
||||
return (
|
||||
<StyledHeader name='application-header'>
|
||||
<StyledHeader
|
||||
name='application-header'
|
||||
onBlur={handleHideToggle}
|
||||
onFocus={handleHideToggle}
|
||||
>
|
||||
<Row>
|
||||
<Column lg={10} xs={8}>
|
||||
<Link to='/'>
|
||||
|
@ -10,7 +10,7 @@ const mapStateToProps = (state, ownProps) => ({
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
handleToggle: () => dispatch(toggleHeaderTooltip())
|
||||
handleToggle: (bool) => dispatch(toggleHeaderTooltip(bool))
|
||||
});
|
||||
|
||||
export default connect(
|
||||
|
@ -2,13 +2,11 @@ import { handleActions } from 'redux-actions';
|
||||
import { toggleHeaderTooltip } from '@state/actions';
|
||||
|
||||
export default handleActions({
|
||||
[toggleHeaderTooltip.toString()]: (state, action) => {
|
||||
return {
|
||||
[toggleHeaderTooltip.toString()]: (state, action) => ({
|
||||
...state,
|
||||
ui: {
|
||||
...state.ui,
|
||||
tooltip: !state.ui.tooltip
|
||||
}
|
||||
};
|
||||
tooltip: action.payload
|
||||
}
|
||||
})
|
||||
}, {});
|
||||
|
Loading…
Reference in New Issue
Block a user