Skip to content

Commit

Permalink
Merge pull request #122 from GSPanue/master
Browse files Browse the repository at this point in the history
Open permalink in a new tab
  • Loading branch information
rwieruch authored Aug 11, 2018
2 parents 5659374 + 6494658 commit 4b185e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/components/Permalink/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import PropTypes from 'prop-types';
import React from 'react';

function Permalink({ link, text, title }) {
function Permalink({ link, text, title, openInNewTab }) {
const additionalAttributes = (openInNewTab) ? { target: '_blank', rel: 'noopener' } : {};

return (
<a href={link} title={title}>
<a href={link} title={title} {...additionalAttributes}>
<span>{text}</span>
</a>
);
Expand All @@ -12,7 +14,8 @@ function Permalink({ link, text, title }) {
Permalink.propTypes = {
link: PropTypes.string,
text: PropTypes.string,
title: PropTypes.string
title: PropTypes.string,
openInNewTab: PropTypes.bool
};

export default Permalink;
4 changes: 2 additions & 2 deletions src/components/Track/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ function TrackStream({
<div>
<TrackIcon trackCount={typeTracks[activity.id]} />
<RepostIcon repostCount={typeReposts[activity.id]} />
<Permalink link={userEntity.permalink_url} text={username}/>
<Permalink link={userEntity.permalink_url} text={username} openInNewTab />
&nbsp;&#8209;&nbsp;
<Permalink link={permalink_url} text={title} />
<Permalink link={permalink_url} text={title} openInNewTab />
</div>
<div>
<Duration
Expand Down

0 comments on commit 4b185e5

Please sign in to comment.