From 84522246737e13aca2630be9acae708c9ee42849 Mon Sep 17 00:00:00 2001 From: Happy-Ferret Date: Fri, 9 Mar 2018 11:17:17 +0100 Subject: [PATCH] Use siteConfig properties inside Example pages Replace hardcoded values inside "footer", "help" and "users" with properties from siteConfig. Fixes #488 --- examples/basics/core/Footer.js | 4 +--- examples/basics/pages/en/help.js | 11 +++++++++-- examples/basics/pages/en/users.js | 5 ++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/examples/basics/core/Footer.js b/examples/basics/core/Footer.js index 2aff77ca2cab..ee6394f4ea88 100644 --- a/examples/basics/core/Footer.js +++ b/examples/basics/core/Footer.js @@ -88,9 +88,7 @@ class Footer extends React.Component { height="45" /> -
- Copyright © {currentYear} Facebook Inc. -
+
{this.props.config.copyright}
); } diff --git a/examples/basics/pages/en/help.js b/examples/basics/pages/en/help.js index 864c2a47fe3a..baff8e747e56 100755 --- a/examples/basics/pages/en/help.js +++ b/examples/basics/pages/en/help.js @@ -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', }, { diff --git a/examples/basics/pages/en/users.js b/examples/basics/pages/en/users.js index f359cc5b32c5..297e4194c33c 100644 --- a/examples/basics/pages/en/users.js +++ b/examples/basics/pages/en/users.js @@ -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 ( @@ -35,9 +36,7 @@ class Users extends React.Component {
{showcase}

Are you using this project?

-
+ Add your company