Skip to content

Commit

Permalink
keep the tooltip up while user hover over it
Browse files Browse the repository at this point in the history
  • Loading branch information
p0o committed Jan 9, 2017
1 parent 06a90ef commit ac157c5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import persistState from 'redux-localstorage';
import persistSlicer from 'redux-localstorage-slicer';
import thunk from 'redux-thunk';
import { combineReducers, applyMiddleware, createStore, compose } from 'redux';
import { reducer as tooltip } from 'redux-tooltip';
import { reducer as tooltip, middleware as tooltipMW } from 'redux-tooltip';
import api from './steemAPI';

import MessagesWorker, { messagesReducer } from './messages';
Expand Down Expand Up @@ -58,7 +58,8 @@ const middleware = [
thunk.withExtraArgument({
messagesWorker,
steemAPI: api,
})
}),
tooltipMW
];

const enhancer = compose(
Expand Down
1 change: 1 addition & 0 deletions src/user/profileTooltip/ProfileTooltipOrigin.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default class ProfileTooltipOrigin extends Component {
<Origin
name="userProfile"
content={<ProfileTooltip username={this.props.username} store={this.context.store} />}
delay
>
{ this.props.children }
</Origin>
Expand Down
12 changes: 10 additions & 2 deletions src/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { Component, PropTypes } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { IntlProvider } from 'react-intl';
import { Tooltip } from 'redux-tooltip';
import { Tooltip, actions as tooltipActions } from 'redux-tooltip';

import { login } from './auth/authActions';
import { getConfig } from './actions';
Expand All @@ -27,6 +27,8 @@ import * as reblogActions from './app/Reblog/reblogActions';
notify,
getStoredBookmarks,
getRebloggedList: reblogActions.getRebloggedList,
keepTooltip: tooltipActions.keep,
hideTooltip: tooltipActions.hide,
}, dispatch)
)

Expand Down Expand Up @@ -63,7 +65,13 @@ export default class Wrapper extends Component {
</div>
: <Splash />
}
<Tooltip name="userProfile" store={this.props.store} place="right"/>
<Tooltip
name="userProfile"
store={this.props.store}
place="right"
onHover={() => this.props.keepTooltip({ name: 'userProfile' })}
onLeave={() => this.props.hideTooltip({ name: 'userProfile' })}
/>
</div>
</IntlProvider>
);
Expand Down

0 comments on commit ac157c5

Please sign in to comment.