From b263e2d1dc8a924fc0c4066f10acf8d56359fdd7 Mon Sep 17 00:00:00 2001 From: endiliey Date: Wed, 16 May 2018 11:47:44 +0800 Subject: [PATCH 1/7] enhance footer with social media buttons --- docs/api-site-config.md | 3 ++ website/core/Footer.js | 67 +++++++++++++++++++++++++++-------------- website/siteConfig.js | 1 + 3 files changed, 48 insertions(+), 23 deletions(-) diff --git a/docs/api-site-config.md b/docs/api-site-config.md index 1371271ce942..8ce061ced7ef 100644 --- a/docs/api-site-config.md +++ b/docs/api-site-config.md @@ -154,6 +154,8 @@ h1 { `twitter` - Set this to `true` if you want a Twitter social button to appear at the bottom of your blog posts. +`twitterId` - If you want a Twitter follow button at the bottom of your page, provide a twitter id to follow. For example: `docusaurus` + `twitterImage` - Local path to your Twitter card image (e.g., `img/myImage.png`). This image will show up on the Twitter card when your site is shared on Twitter. `useEnglishUrl` - If you do not have [translations](guides-translation.md) enabled (e.g., by having a `languages.js` file), but still want a link of the form `/docs/en/doc.html` (with the `en`), set this to `true`. @@ -231,6 +233,7 @@ const siteConfig = { facebookAppId: '1615782811974223', facebookPixelId: '352490515235776', twitter: 'true', + twitterId: 'docusaurus', twitterImage: 'img/docusaurus.png', ogImage: 'img/docusaurus.png', }; diff --git a/website/core/Footer.js b/website/core/Footer.js index 540305f05a3c..4c13b0bca19a 100644 --- a/website/core/Footer.js +++ b/website/core/Footer.js @@ -8,21 +8,51 @@ const PropTypes = require('prop-types'); const React = require('react'); -const GitHubButton = props => ( - - Star - +const SocialFooter = props => ( +
+
+
Github
+ + {props.config.projectName} + +
+ {props.config.twitterId ? ( +
+
Twitter
+ + Follow @{props.config.twitterId} + +
+ ) : null} + {props.config.facebookAppId ? ( +
+
Facebook
+
+
+ ) : null} +
); -GitHubButton.propTypes = { +SocialFooter.propTypes = { config: PropTypes.object }; @@ -77,17 +107,8 @@ class Footer extends React.Component { > User Showcase - - Twitter - -
-
-
More
- - GitHub - -
+ Date: Tue, 15 May 2018 21:57:08 -0700 Subject: [PATCH 2/7] Update api-site-config.md --- docs/api-site-config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api-site-config.md b/docs/api-site-config.md index 8ce061ced7ef..d13401593d66 100644 --- a/docs/api-site-config.md +++ b/docs/api-site-config.md @@ -154,7 +154,7 @@ h1 { `twitter` - Set this to `true` if you want a Twitter social button to appear at the bottom of your blog posts. -`twitterId` - If you want a Twitter follow button at the bottom of your page, provide a twitter id to follow. For example: `docusaurus` +`twitterId` - If you want a Twitter follow button in the footer, provide a twitter id to follow. For example: `docusaurus`. `twitterImage` - Local path to your Twitter card image (e.g., `img/myImage.png`). This image will show up on the Twitter card when your site is shared on Twitter. From 24adf1a289101c262ac52be9caf12a975b008885 Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Tue, 15 May 2018 21:59:43 -0700 Subject: [PATCH 3/7] Update Footer.js --- website/core/Footer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/core/Footer.js b/website/core/Footer.js index 4c13b0bca19a..d23cc523689d 100644 --- a/website/core/Footer.js +++ b/website/core/Footer.js @@ -11,7 +11,7 @@ const React = require('react'); const SocialFooter = props => (
-
Github
+
GitHub
Date: Wed, 16 May 2018 13:30:40 +0800 Subject: [PATCH 4/7] fix minor issue on social-footer --- docs/api-site-config.md | 4 ++-- lib/core/Site.js | 2 +- website/core/Footer.js | 12 ++++++------ website/siteConfig.js | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/api-site-config.md b/docs/api-site-config.md index d13401593d66..afa50c47b262 100644 --- a/docs/api-site-config.md +++ b/docs/api-site-config.md @@ -154,7 +154,7 @@ h1 { `twitter` - Set this to `true` if you want a Twitter social button to appear at the bottom of your blog posts. -`twitterId` - If you want a Twitter follow button in the footer, provide a twitter id to follow. For example: `docusaurus`. +`twitterUsername` - If you want a Twitter follow button at the bottom of your page, provide a twitter username to follow. For example: `docusaurus` `twitterImage` - Local path to your Twitter card image (e.g., `img/myImage.png`). This image will show up on the Twitter card when your site is shared on Twitter. @@ -233,7 +233,7 @@ const siteConfig = { facebookAppId: '1615782811974223', facebookPixelId: '352490515235776', twitter: 'true', - twitterId: 'docusaurus', + twitterUsername: 'docusaurus', twitterImage: 'img/docusaurus.png', ogImage: 'img/docusaurus.png', }; diff --git a/lib/core/Site.js b/lib/core/Site.js index 9c151f4f0905..61032f34a5ea 100644 --- a/lib/core/Site.js +++ b/lib/core/Site.js @@ -111,7 +111,7 @@ class Site extends React.Component { }} /> )} - {this.props.config.twitter && ( + {(this.props.config.twitter || this.props.config.twitterUsername) && (