diff --git a/client/coral-plugin-author-name/AuthorName.js b/client/coral-plugin-author-name/AuthorName.js index fcf464403..06caab381 100644 --- a/client/coral-plugin-author-name/AuthorName.js +++ b/client/coral-plugin-author-name/AuthorName.js @@ -1,51 +1,47 @@ import React, {Component} from 'react'; import {Tooltip} from 'coral-ui'; -import FlagBio from '../coral-plugin-flags/FlagBio'; +import FlagBio from 'coral-plugin-flags/FlagBio'; const packagename = 'coral-plugin-author-name'; +import styles from './styles.css'; export default class AuthorName extends Component { - constructor (props) { - super(props); - this.state = { - showTooltip: false - }; + state = {showTooltip: false} - this.handleMouseOver = this.handleMouseOver.bind(this); - this.handleMouseLeave = this.handleMouseLeave.bind(this); + handleClick = () => { + this.setState(state => ({ + showTooltip: !state.showTooltip + })); } - handleMouseOver () { - this.setState({ - showTooltip: true - }); - } - - handleMouseLeave () { - this.setState({ - showTooltip: false - }); + handleMouseLeave = () => { + setTimeout(() => { + this.setState({ + showTooltip: false + }); + }, 500); } render () { const {author} = this.props; const {showTooltip} = this.state; return ( -