diff --git a/examples/siteConfig.js b/examples/siteConfig.js index 46a3f6418b..606a023219 100644 --- a/examples/siteConfig.js +++ b/examples/siteConfig.js @@ -64,17 +64,18 @@ const siteConfig = { "rgba(46, 133, 85, 0.03)" /* primaryColor in rgba form, with 0.03 alpha */ }, tagline: "My Tagline", - recruitingLink: "https://crowdin.com/project/test-site" /* translation site "help translate" link */, + recruitingLink: + "https://crowdin.com/project/test-site" /* translation site "help translate" link */, /* remove this section to disable search bar */ algolia: { - apiKey: "0f9f28b9ab9efae89810921a351753b5", /* use your search-only api key */ + apiKey: + "0f9f28b9ab9efae89810921a351753b5" /* use your search-only api key */, indexName: "github" - }, + } /* remove this to disable google analytics tracking */ /* gaTrackingId: "" */ }; - /* DO NOT EDIT BELOW THIS LINE */ const fs = require("fs"); diff --git a/lib/copy-examples.js b/lib/copy-examples.js index ba54b12657..7bb893d1cd 100644 --- a/lib/copy-examples.js +++ b/lib/copy-examples.js @@ -10,6 +10,6 @@ */ const CWD = process.cwd(); -const fs = require('fs-extra'); +const fs = require("fs-extra"); -fs.copySync(__dirname + '/../examples/', CWD, {overwrite: false}); +fs.copySync(__dirname + "/../examples/", CWD, { overwrite: false }); diff --git a/lib/core/BlogPageLayout.js b/lib/core/BlogPageLayout.js index f8f644380f..771e4fc5ed 100644 --- a/lib/core/BlogPageLayout.js +++ b/lib/core/BlogPageLayout.js @@ -7,44 +7,53 @@ * of patent rights can be found in the PATENTS file in the same directory. */ - const BlogPost = require('./BlogPost.js'); -const BlogSidebar = require('./BlogSidebar.js'); -const Container = require('./Container.js'); -const MetadataBlog = require('./MetadataBlog.js'); -const React = require('react'); -const Site = require('./Site.js'); +const BlogPost = require("./BlogPost.js"); +const BlogSidebar = require("./BlogSidebar.js"); +const Container = require("./Container.js"); +const MetadataBlog = require("./MetadataBlog.js"); +const React = require("react"); +const Site = require("./Site.js"); const BlogPageLayout = React.createClass({ getPageURL(page) { - let url = this.props.config.baseUrl + 'blog/'; + let url = this.props.config.baseUrl + "blog/"; if (page > 0) { - url += 'page' + (page + 1) + '/'; + url += "page" + (page + 1) + "/"; } - return url + '#content'; + return url + "#content"; }, render() { const perPage = this.props.metadata.perPage; const page = this.props.metadata.page; return ( - +
- +
- {MetadataBlog - .slice(page * perPage, (page + 1) * perPage) - .map(post => { - return ( - - ); - })} + {MetadataBlog.slice( + page * perPage, + (page + 1) * perPage + ).map(post => { + return ( + + ); + })} ); - }, + } }); module.exports = BlogPageLayout; diff --git a/lib/core/BlogPost.js b/lib/core/BlogPost.js index 3f92f32024..71da9c3e3c 100644 --- a/lib/core/BlogPost.js +++ b/lib/core/BlogPost.js @@ -7,26 +7,35 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -const Marked = require('./Marked.js'); -const React = require('react'); +const Marked = require("./Marked.js"); +const React = require("react"); class BlogPost extends React.Component { renderContent() { let content = this.props.content; if (this.props.truncate) { - content = content.split('')[0]; + content = content.split("")[0]; return ( ); } - return {content}; + return ( + + {content} + + ); } renderAuthorPhoto() { @@ -37,9 +46,9 @@ class BlogPost extends React.Component { @@ -54,7 +63,9 @@ class BlogPost extends React.Component { const post = this.props.post; return (

- {post.title} + + {post.title} +

); } @@ -65,18 +76,18 @@ class BlogPost extends React.Component { // Because JavaScript sucks at date handling :( const year = match[1]; const month = [ - 'January', - 'February', - 'March', - 'April', - 'May', - 'June', - 'July', - 'August', - 'September', - 'October', - 'November', - 'December', + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" ][parseInt(match[2], 10) - 1]; const day = parseInt(match[3], 10); @@ -84,7 +95,9 @@ class BlogPost extends React.Component {
{this.renderAuthorPhoto()}

- {post.author} + + {post.author} +

{this.renderTitle()}

diff --git a/lib/core/BlogPostLayout.js b/lib/core/BlogPostLayout.js index dab0433f20..fe713e4030 100644 --- a/lib/core/BlogPostLayout.js +++ b/lib/core/BlogPostLayout.js @@ -7,11 +7,11 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -const React = require('react'); -const BlogPost = require('./BlogPost.js'); -const BlogSidebar = require('./BlogSidebar.js'); -const Container = require('./Container.js'); -const Site = require('./Site.js'); +const React = require("react"); +const BlogPost = require("./BlogPost.js"); +const BlogSidebar = require("./BlogSidebar.js"); +const Container = require("./Container.js"); +const Site = require("./Site.js"); class BlogPostLayout extends React.Component { render() { @@ -19,20 +19,24 @@ class BlogPostLayout extends React.Component {

- +
diff --git a/lib/core/BlogSidebar.js b/lib/core/BlogSidebar.js index c4311dfba3..978a2017d1 100644 --- a/lib/core/BlogSidebar.js +++ b/lib/core/BlogSidebar.js @@ -7,22 +7,24 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -const React = require('react'); -const Container = require('./Container.js'); -const SideNav = require('./nav/SideNav.js'); +const React = require("react"); +const Container = require("./Container.js"); +const SideNav = require("./nav/SideNav.js"); -const MetadataBlog = require('./MetadataBlog.js'); +const MetadataBlog = require("./MetadataBlog.js"); class BlogSidebar extends React.Component { render() { - const contents = [{ - name: 'Recent Posts', - links: MetadataBlog, - }]; + const contents = [ + { + name: "Recent Posts", + links: MetadataBlog + } + ]; const title = this.props.current && this.props.current.title; const current = { - id: title || '', - category: 'Recent Posts', + id: title || "", + category: "Recent Posts" }; return ( diff --git a/lib/core/CompLibrary.js b/lib/core/CompLibrary.js index 1e6f3bee71..c138962b88 100644 --- a/lib/core/CompLibrary.js +++ b/lib/core/CompLibrary.js @@ -7,12 +7,12 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -const Marked = require('./Marked.js'); -const Container = require('./Container.js'); -const GridBlock = require('./GridBlock.js'); +const Marked = require("./Marked.js"); +const Container = require("./Container.js"); +const GridBlock = require("./GridBlock.js"); module.exports = { Marked: Marked, Container: Container, GridBlock: GridBlock -} +}; diff --git a/lib/core/Container.js b/lib/core/Container.js index 6dca6d8ca1..ae8573cc06 100644 --- a/lib/core/Container.js +++ b/lib/core/Container.js @@ -7,26 +7,29 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -const React = require('react'); -const classNames = require('classnames'); +const React = require("react"); +const classNames = require("classnames"); class Container extends React.Component { render() { - const containerClasses = classNames('container', this.props.className, { - 'darkBackground': this.props.background === 'dark', - 'highlightBackground': this.props.background === 'highlight', - 'lightBackground': this.props.background === 'light', - 'paddingAll': this.props.padding.indexOf('all') >= 0, - 'paddingBottom': this.props.padding.indexOf('bottom') >= 0, - 'paddingLeft': this.props.padding.indexOf('left') >= 0, - 'paddingRight': this.props.padding.indexOf('right') >= 0, - 'paddingTop': this.props.padding.indexOf('top') >= 0, + const containerClasses = classNames("container", this.props.className, { + darkBackground: this.props.background === "dark", + highlightBackground: this.props.background === "highlight", + lightBackground: this.props.background === "light", + paddingAll: this.props.padding.indexOf("all") >= 0, + paddingBottom: this.props.padding.indexOf("bottom") >= 0, + paddingLeft: this.props.padding.indexOf("left") >= 0, + paddingRight: this.props.padding.indexOf("right") >= 0, + paddingTop: this.props.padding.indexOf("top") >= 0 }); let wrappedChildren; if (this.props.wrapper) { - wrappedChildren = -
{this.props.children}
; + wrappedChildren = ( +
+ {this.props.children} +
+ ); } else { wrappedChildren = this.props.children; } @@ -39,9 +42,9 @@ class Container extends React.Component { } Container.defaultProps = { - background: 'transparent', + background: "transparent", padding: [], - wrapper: true, + wrapper: true }; module.exports = Container; diff --git a/lib/core/Doc.js b/lib/core/Doc.js index 97022dfd9c..4832a8a295 100644 --- a/lib/core/Doc.js +++ b/lib/core/Doc.js @@ -7,8 +7,8 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -const React = require('react'); -const Marked = require('./Marked.js'); +const React = require("react"); +const Marked = require("./Marked.js"); class Doc extends React.Component { render() { @@ -17,9 +17,9 @@ class Doc extends React.Component { className="edit-page-link button" href={ this.props.config.editUrl + - this.props.language + - '/' + - this.props.source + this.props.language + + "/" + + this.props.source } target="_blank" > @@ -30,10 +30,14 @@ class Doc extends React.Component {
{editLink} -

{this.props.title}

+

+ {this.props.title} +

- {this.props.content} + + {this.props.content} +
); diff --git a/lib/core/DocsLayout.js b/lib/core/DocsLayout.js index ba846a5448..6803e836de 100644 --- a/lib/core/DocsLayout.js +++ b/lib/core/DocsLayout.js @@ -7,11 +7,11 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -const React = require('react'); -const Container = require('./Container.js'); -const Doc = require('./Doc.js'); -const DocsSidebar = require('./DocsSidebar.js'); -const Site = require('./Site.js'); +const React = require("react"); +const Container = require("./Container.js"); +const Doc = require("./Doc.js"); +const DocsSidebar = require("./DocsSidebar.js"); +const Site = require("./Site.js"); class DocsLayout extends React.Component { render() { @@ -24,11 +24,13 @@ class DocsLayout extends React.Component { className="sideNavVisible" section="docs" title={ - i18n ? this.props.config[this.props.metadata.language]['localized-strings'][ - this.props.metadata.localized_id - ] || this.props.metadata.title : this.props.metadata.title + i18n + ? this.props.config[this.props.metadata.language][ + "localized-strings" + ][this.props.metadata.localized_id] || this.props.metadata.title + : this.props.metadata.title } - description={content.trim().split('\n')[0]} + description={content.trim().split("\n")[0]} language={metadata.language} >
@@ -39,9 +41,12 @@ class DocsLayout extends React.Component { config={this.props.config} source={metadata.source} title={ - i18n ? this.props.config[this.props.metadata.language]['localized-strings'][ - this.props.metadata.localized_id - ] || this.props.metadata.title : this.props.metadata.title + i18n + ? this.props.config[this.props.metadata.language][ + "localized-strings" + ][this.props.metadata.localized_id] || + this.props.metadata.title + : this.props.metadata.title } language={metadata.language} /> @@ -49,27 +54,25 @@ class DocsLayout extends React.Component { {metadata.previous_id && - ← - {' '} - { - i18n ? this.props.config[this.props.metadata.language][ - 'localized-strings' - ]['previous'] || 'Previous' : 'Previous' - } + ←{" "} + {i18n + ? this.props.config[this.props.metadata.language][ + "localized-strings" + ]["previous"] || "Previous" + : "Previous"} } {metadata.next_id && - { - i18n ? this.props.config[this.props.metadata.language][ - 'localized-strings' - ]['next'] || 'Next' : 'Next' - } - {' '} + {i18n + ? this.props.config[this.props.metadata.language][ + "localized-strings" + ]["next"] || "Next" + : "Next"}{" "} → }
diff --git a/lib/core/DocsSidebar.js b/lib/core/DocsSidebar.js index 9c6024d4b1..43883a9a9c 100644 --- a/lib/core/DocsSidebar.js +++ b/lib/core/DocsSidebar.js @@ -7,16 +7,16 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -const Metadata = require('./metadata.js'); -const React = require('react'); -const Container = require('./Container.js'); -const SideNav = require('./nav/SideNav.js'); -const siteConfig = require(process.cwd() + '/siteConfig.js'); +const Metadata = require("./metadata.js"); +const React = require("react"); +const Container = require("./Container.js"); +const SideNav = require("./nav/SideNav.js"); +const siteConfig = require(process.cwd() + "/siteConfig.js"); class DocsSidebar extends React.Component { render() { let layout = this.props.metadata.layout; - let docsCategories = require('./' + layout + 'Categories.js'); + let docsCategories = require("./" + layout + "Categories.js"); return ( + aria-label="Star this project on GitHub" + > Star ); @@ -40,21 +41,30 @@ class Footer extends React.Component {
Docs
Getting Started (or other categories) Guides (or other categories) API Reference (or other categories) @@ -62,7 +72,11 @@ class Footer extends React.Component {
More
@@ -106,6 +118,4 @@ class Footer extends React.Component { } } - - module.exports = Footer; diff --git a/lib/core/GridBlock.js b/lib/core/GridBlock.js index 30820def69..aeb6c212a7 100755 --- a/lib/core/GridBlock.js +++ b/lib/core/GridBlock.js @@ -7,31 +7,32 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -const React = require('react'); -const classNames = require('classnames'); +const React = require("react"); +const classNames = require("classnames"); -const Marked = require('./Marked.js'); +const Marked = require("./Marked.js"); class GridBlock extends React.Component { renderBlock(block) { - const blockClasses = classNames('blockElement', this.props.className, { - 'alignCenter': this.props.align === 'center', - 'alignRight': this.props.align === 'right', - 'fourByGridBlock': this.props.layout === 'fourColumn', - 'imageAlignBottom': (block.image && block.imageAlign === 'bottom'), - 'imageAlignSide': (block.image && (block.imageAlign === 'left' || - block.imageAlign === 'right')), - 'imageAlignTop': (block.image && block.imageAlign === 'top'), - 'threeByGridBlock': this.props.layout === 'threeColumn', - 'twoByGridBlock': this.props.layout === 'twoColumn', + const blockClasses = classNames("blockElement", this.props.className, { + alignCenter: this.props.align === "center", + alignRight: this.props.align === "right", + fourByGridBlock: this.props.layout === "fourColumn", + imageAlignBottom: block.image && block.imageAlign === "bottom", + imageAlignSide: + block.image && + (block.imageAlign === "left" || block.imageAlign === "right"), + imageAlignTop: block.image && block.imageAlign === "top", + threeByGridBlock: this.props.layout === "threeColumn", + twoByGridBlock: this.props.layout === "twoColumn" }); - const topLeftImage = (block.imageAlign === 'top' || - block.imageAlign === 'left') && + const topLeftImage = + (block.imageAlign === "top" || block.imageAlign === "left") && this.renderBlockImage(block.image); - const bottomRightImage = (block.imageAlign === 'bottom' || - block.imageAlign === 'right') && + const bottomRightImage = + (block.imageAlign === "bottom" || block.imageAlign === "right") && this.renderBlockImage(block.image); return ( @@ -39,7 +40,9 @@ class GridBlock extends React.Component { {topLeftImage}
{this.renderBlockTitle(block.title)} - {block.content} + + {block.content} +
{bottomRightImage}
@@ -49,7 +52,9 @@ class GridBlock extends React.Component { renderBlockImage(image) { if (image) { return ( -
+
+ +
); } else { return null; @@ -58,7 +63,11 @@ class GridBlock extends React.Component { renderBlockTitle(title) { if (title) { - return

{title}

; + return ( +

+ {title} +

+ ); } else { return null; } @@ -74,10 +83,10 @@ class GridBlock extends React.Component { } GridBlock.defaultProps = { - align: 'left', + align: "left", contents: [], - imagealign: 'top', - layout: 'twoColumn', + imagealign: "top", + layout: "twoColumn" }; module.exports = GridBlock; diff --git a/lib/core/Head.js b/lib/core/Head.js index 41c0849730..1860b83863 100644 --- a/lib/core/Head.js +++ b/lib/core/Head.js @@ -7,7 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -const React = require('react'); +const React = require("react"); class Head extends React.Component { render() { @@ -29,19 +29,29 @@ class Head extends React.Component { - {this.props.title} + + {this.props.title} + - + {this.props.config.algolia && - - } - - + } + +