Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ad7e9d7

Browse files
Tilde Ann Thuriummofo37
andcommitted
Add tooltip to github-tile-view
Co-Authored-By: mofo37 <[email protected]>
1 parent 755132b commit ad7e9d7

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

lib/controllers/status-bar-tile-controller.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ export default class StatusBarTileController extends React.Component {
8989
return (
9090
<Fragment>
9191
{this.renderTiles(repoProps)}
92-
<GithubTileView didClick={this.props.toggleGithubTab} />
92+
<GithubTileView
93+
didClick={this.props.toggleGithubTab}
94+
tooltips={this.props.tooltips}
95+
/>
9396
<ChangedFilesCountView
9497
didClick={this.props.toggleGitTab}
9598
changedFilesCount={repoProps.changedFilesCount}

lib/views/github-tile-view.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,21 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import Octicon from '../atom/octicon';
44

5+
import RefHolder from '../models/ref-holder';
6+
import Tooltip from '../atom/tooltip';
57
import {addEvent} from '../reporter-proxy';
68
import {autobind} from '../helpers';
79

810
export default class GithubTileView extends React.Component {
911
static propTypes = {
1012
didClick: PropTypes.func.isRequired,
13+
tooltips: PropTypes.object.isRequired
1114
}
1215

1316
constructor(props) {
1417
super(props);
1518
autobind(this, 'handleClick');
19+
this.refTileNode = new RefHolder();
1620
}
1721

1822
handleClick() {
@@ -22,12 +26,22 @@ export default class GithubTileView extends React.Component {
2226

2327
render() {
2428
return (
25-
<button
26-
className="github-StatusBarTile inline-block"
27-
onClick={this.handleClick}>
28-
<Octicon icon="mark-github" />
29-
GitHub
30-
</button>
29+
<span ref={this.refTileNode.setter}>
30+
<button
31+
className="github-StatusBarTile inline-block"
32+
onClick={this.handleClick}>
33+
<Octicon icon="mark-github" />
34+
GitHub
35+
</button>
36+
<Tooltip
37+
key="tooltip"
38+
manager={this.props.tooltips}
39+
target={this.refTileNode}
40+
title={`<div style="text-align: left; line-height: 1.2em;">${'hi'}</div>`}
41+
showDelay={atom.tooltips.hoverDefaults.delay.show}
42+
hideDelay={atom.tooltips.hoverDefaults.delay.hide}
43+
/>
44+
</span>
3145
);
3246
}
3347
}

0 commit comments

Comments
 (0)