Merge pull request #4737 from seotts/team-new-tabs

In the Annual Report Team section, open link to Scratch Team members in new tab
This commit is contained in:
Sarah Otts 2021-01-05 14:38:03 -05:00 committed by GitHub
commit 78d001e127
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View file

@ -13,7 +13,11 @@ const PeopleGrid = props => (
>
<div>
{person.userName ? (
<a href={`https://scratch.mit.edu/users/${person.userName}/`}>
<a
href={`https://scratch.mit.edu/users/${person.userName}/`}
rel="noreferrer noopener"
target={props.linkToNewTab ? '_blank' : '_self'}
>
<Avatar
alt=""
src={`https://cdn.scratch.mit.edu/get_image/user/${person.userId || 'default'}_80x80.png`}
@ -36,6 +40,7 @@ const PeopleGrid = props => (
);
PeopleGrid.propTypes = {
linkToNewTab: PropTypes.bool,
people: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string,
userId: PropTypes.number,
@ -43,4 +48,8 @@ PeopleGrid.propTypes = {
}))
};
PeopleGrid.defaultProps = {
linkToNewTab: false
};
module.exports = PeopleGrid;

View file

@ -2178,6 +2178,7 @@ class AnnualReport extends React.Component {
</h3>
<div className="executive-director">
<PeopleGrid
linkToNewTab
people={[{
userName: 'Champ99',
userId: 900283,
@ -2186,7 +2187,10 @@ class AnnualReport extends React.Component {
/>
<FormattedMessage id="annualReport.leadershipInterim" />
</div>
<PeopleGrid people={People} />
<PeopleGrid
linkToNewTab
people={People}
/>
</div>
</div>
</div>