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 ( -
- {author && author.name} - { showTooltip && author.settings.bio && +
+ + {author && author.name} + {author.settings.bio ? : null} + + {showTooltip && author.settings.bio + && ( +
{author.settings.bio}
-
- } + + )}
); } diff --git a/client/coral-plugin-author-name/styles.css b/client/coral-plugin-author-name/styles.css new file mode 100644 index 000000000..ef93c43d8 --- /dev/null +++ b/client/coral-plugin-author-name/styles.css @@ -0,0 +1,32 @@ +.authorName { + color: black; + display: inline-block; + margin: 10px 0; + + &:hover { + cursor: pointer; + } +} + +.arrowDown { + top: 0; + width: 0; + height: 0; + margin-top: -2px; + margin-left: 2px; + display: inline-block; + vertical-align: middle; + border-bottom: 0; + border-left: 3px solid transparent; + border-right: 3px solid transparent; + border-top: 3px solid #000000; +} + +.arrowUp { + width: 0; + height: 0; + border-top: 0; + border-left: 3px solid transparent; + border-right: 3px solid transparent; + border-bottom: 3px solid black; +} diff --git a/client/coral-ui/components/Tooltip.css b/client/coral-ui/components/Tooltip.css index cf849b7cb..75c70c921 100644 --- a/client/coral-ui/components/Tooltip.css +++ b/client/coral-ui/components/Tooltip.css @@ -3,7 +3,7 @@ position: absolute; width: 100%; border: solid 1px #2376D8; - top: 33px; + top: 48px; left: 0; box-sizing: border-box; background: white;