fix(v1): check repo url before using on Users page (#2331)

* fix: check repoUrl before rendering edit link in users

* refactor: prettier
This commit is contained in:
Joe Previte 2020-02-26 14:59:04 -08:00 committed by GitHub
parent 7fd242aeb1
commit 590de95234
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View file

@ -18,7 +18,6 @@ class Users extends React.Component {
return null;
}
const editUrl = `${siteConfig.repoUrl}/edit/master/website/siteConfig.js`;
const showcase = siteConfig.users.map(user => (
<a href={user.infoLink} key={user.infoLink}>
<img src={user.image} alt={user.caption} title={user.caption} />
@ -34,10 +33,16 @@ class Users extends React.Component {
<p>This project is used by many folks</p>
</div>
<div className="logos">{showcase}</div>
<p>Are you using this project?</p>
<a href={editUrl} className="button">
Add your company
</a>
{siteConfig.repoUrl && (
<>
<p>Are you using this project?</p>
<a
href={`${siteConfig.repoUrl}/edit/master/website/siteConfig.js`}
className="button">
Add your company
</a>
</>
)}
</div>
</Container>
</div>

View file

@ -104,7 +104,7 @@ const siteConfig = {
// You may provide arbitrary config keys to be used as needed by your
// template. For example, if you need your repo's URL...
// repoUrl: 'https://github.com/facebook/test-site',
// repoUrl: 'https://github.com/facebook/test-site',
};
module.exports = siteConfig;