mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-09 23:27:28 +02:00
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:
parent
7fd242aeb1
commit
590de95234
2 changed files with 11 additions and 6 deletions
|
@ -18,7 +18,6 @@ class Users extends React.Component {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const editUrl = `${siteConfig.repoUrl}/edit/master/website/siteConfig.js`;
|
|
||||||
const showcase = siteConfig.users.map(user => (
|
const showcase = siteConfig.users.map(user => (
|
||||||
<a href={user.infoLink} key={user.infoLink}>
|
<a href={user.infoLink} key={user.infoLink}>
|
||||||
<img src={user.image} alt={user.caption} title={user.caption} />
|
<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>
|
<p>This project is used by many folks</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="logos">{showcase}</div>
|
<div className="logos">{showcase}</div>
|
||||||
<p>Are you using this project?</p>
|
{siteConfig.repoUrl && (
|
||||||
<a href={editUrl} className="button">
|
<>
|
||||||
Add your company
|
<p>Are you using this project?</p>
|
||||||
</a>
|
<a
|
||||||
|
href={`${siteConfig.repoUrl}/edit/master/website/siteConfig.js`}
|
||||||
|
className="button">
|
||||||
|
Add your company
|
||||||
|
</a>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Container>
|
</Container>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -104,7 +104,7 @@ const siteConfig = {
|
||||||
|
|
||||||
// You may provide arbitrary config keys to be used as needed by your
|
// You may provide arbitrary config keys to be used as needed by your
|
||||||
// template. For example, if you need your repo's URL...
|
// 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;
|
module.exports = siteConfig;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue