Skip to content

Commit

Permalink
Use siteConfig properties inside Example pages (#497)
Browse files Browse the repository at this point in the history
Replace hardcoded values inside "footer",
"help" and "users" with properties
from siteConfig.

Fixes #488
  • Loading branch information
Happy-Ferret authored and JoelMarcey committed Mar 16, 2018
1 parent ad94258 commit 37c699e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 1 addition & 3 deletions examples/basics/core/Footer.js
Expand Up @@ -88,9 +88,7 @@ class Footer extends React.Component {
height="45"
/>
</a>
<section className="copyright">
Copyright &copy; {currentYear} Facebook Inc.
</section>
<section className="copyright">{this.props.config.copyright}</section>
</footer>
);
}
Expand Down
11 changes: 9 additions & 2 deletions examples/basics/pages/en/help.js
Expand Up @@ -13,12 +13,19 @@ const GridBlock = CompLibrary.GridBlock;

const siteConfig = require(process.cwd() + '/siteConfig.js');

function docUrl(doc, language) {
return siteConfig.baseUrl + 'docs/' + (language ? language + '/' : '') + doc;
}

class Help extends React.Component {
render() {
let language = this.props.language || '';
const supportLinks = [
{
content:
'Learn more using the [documentation on this site.](/test-site/docs/en/doc1.html)',
content: `Learn more using the [documentation on this site.](${docUrl(
'doc1.html',
language
)})`,
title: 'Browse Docs',
},
{
Expand Down
5 changes: 2 additions & 3 deletions examples/basics/pages/en/users.js
Expand Up @@ -17,6 +17,7 @@ class Users extends React.Component {
if ((siteConfig.users || []).length === 0) {
return null;
}
const editUrl = siteConfig.repoUrl + '/edit/master/website/siteConfig.js';
const showcase = siteConfig.users.map((user, i) => {
return (
<a href={user.infoLink} key={i}>
Expand All @@ -35,9 +36,7 @@ class Users extends React.Component {
</div>
<div className="logos">{showcase}</div>
<p>Are you using this project?</p>
<a
href="https://github.com/facebook/docusaurus/edit/master/website/siteConfig.js"
className="button">
<a href={editUrl} className="button">
Add your company
</a>
</div>
Expand Down

0 comments on commit 37c699e

Please sign in to comment.