Skip to content

Commit

Permalink
Show Issue body when hovering over title
Browse files Browse the repository at this point in the history
  • Loading branch information
philschatz committed Apr 25, 2016
1 parent cf1babc commit 51eb1bd
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 13 deletions.
55 changes: 42 additions & 13 deletions src/components/issue.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,32 @@ let Issue = React.createClass({
<img className='featured-image' src={card.getFeaturedImageSrc()}/>
);
}


const bodyPopover = (
<BS.Popover className='popover-issue-body' id={`popover-${card.key()}-body`} title={issue.title}>
<GithubFlavoredMarkdown
repoOwner={repoOwner}
repoName={repoName}
text={issue.body}/>
</BS.Popover>
);
const TitleLink = React.createClass({
render() {
const {children} = this.props;
return (
<BS.OverlayTrigger
delayShow={2000}
container={this}
trigger={['hover', 'focus']}
placement='bottom'
overlay={bodyPopover}>
{children}
</BS.OverlayTrigger>
)
}
});

return connectDragSource(
<div className='-drag-source'>
<BS.ListGroupItem
Expand All @@ -372,20 +398,23 @@ let Issue = React.createClass({
className={classnames(classes)}
data-state={issue.state}>

<a
key='link'
className='issue-title'
target='_blank'
href={issue.htmlUrl}>
<GithubFlavoredMarkdown
inline
disableLinks={true}
repoOwner={repoOwner}
repoName={repoName}
text={issue.title}/>
</a>
<TitleLink>
<span className='-extra-span-for-inline-popover'>
<a
key='link'
className='issue-title'
target='_blank'
href={issue.htmlUrl}>
<GithubFlavoredMarkdown
inline
repoOwner={repoOwner}
repoName={repoName}
text={issue.title}/>
</a>
{featuredImage}
</span>
</TitleLink>

{featuredImage}
<span key='labels' className='issue-labels'>
{milestone}
{labels}
Expand Down
7 changes: 7 additions & 0 deletions style/app.less
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,13 @@ body { background-color: #ddd; }
.popover {
max-width: 500px;

&.popover-issue-body {
min-width: 400px; // some popovers are inside an <a> which is inside an Issue body

.arrow { display: none; }
}


.popover-content {
max-height: 300px;
overflow-y: auto;
Expand Down

0 comments on commit 51eb1bd

Please sign in to comment.