Skip to content

Commit

Permalink
Add tooltip to expand/compress button (decred#992)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagoalvesdulce authored and fernandoabolafio committed Jan 18, 2019
1 parent 3d86434 commit 3ae91d8
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/components/snew/ThingLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,21 @@ import {
} from "../../constants";

const ToggleIcon = (type, onClick) => (
<button className="collapse-icon-button" onClick={onClick}>
<i className={`fa fa-${type}`} />
</button>
<div style={{ width: "25px" }}>
<Tooltip
tipStyle={{
fontSize: "14px",
left: "30px",
width: "145px"
}}
text={`${type === "expand" ? "Show" : "Hide"} proposal body`}
position="right"
>
<button className="collapse-icon-button" onClick={onClick}>
<i className={`fa fa-${type}`} />
</button>
</Tooltip>
</div>
);

class ThingLinkComp extends React.Component {
Expand All @@ -39,7 +51,7 @@ class ThingLinkComp extends React.Component {
expanded: !this.props.commentid
};
}
hanldeExpandToggle = e => {
handleExpandToggle = e => {
e && e.preventDefault() && e.stopPropagation();
this.setState(state => ({ expanded: !state.expanded }));
};
Expand Down Expand Up @@ -408,8 +420,8 @@ class ThingLinkComp extends React.Component {
is_self,
selftext,
selftext_html,
expandIcon: ToggleIcon("expand", this.hanldeExpandToggle),
compressIcon: ToggleIcon("compress", this.hanldeExpandToggle)
expandIcon: ToggleIcon("expand", this.handleExpandToggle),
compressIcon: ToggleIcon("compress", this.handleExpandToggle)
}}
/>
{this.state.expanded && (
Expand Down

0 comments on commit 3ae91d8

Please sign in to comment.