Run Prettier

This commit is contained in:
Frank Li 2017-07-10 16:38:35 -07:00
parent a7b5148e06
commit fbae29b0ff
29 changed files with 1311 additions and 987 deletions

View file

@ -7,10 +7,10 @@
* 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 siteConfig = require(process.cwd() + '/siteConfig.js');
const siteConfig = require(process.cwd() + "/siteConfig.js");
class SideNav extends React.Component {
render() {
@ -19,10 +19,14 @@ class SideNav extends React.Component {
<div className="toggleNav">
<section className="navWrapper wrapper">
<div className="navBreadcrumb wrapper">
<div className="navToggle" id="navToggler"><i /></div>
<div className="navToggle" id="navToggler">
<i />
</div>
<h2>
<i></i>
<span>{this.props.current.category}</span>
<span>
{this.props.current.category}
</span>
</h2>
</div>
<div className="navGroups">
@ -38,7 +42,7 @@ class SideNav extends React.Component {
toggler.onclick = function() {
nav.classList.toggle('docsSliderActive');
};
`,
`
}}
/>
</nav>
@ -47,7 +51,9 @@ class SideNav extends React.Component {
renderCategory(category) {
return (
<div className="navGroup navGroupActive" key={category.name}>
<h3>{this.getLocalizedCategoryString(category.name)}</h3>
<h3>
{this.getLocalizedCategoryString(category.name)}
</h3>
<ul>
{category.links.map(this.renderItemLink, this)}
</ul>
@ -55,16 +61,17 @@ class SideNav extends React.Component {
);
}
getLocalizedCategoryString(category) {
let categoryString =
siteConfig[this.props.language] ?
siteConfig[this.props.language]['localized-strings'][category] || category
let categoryString = siteConfig[this.props.language]
? siteConfig[this.props.language]["localized-strings"][category] ||
category
: category;
return categoryString;
}
getLocalizedString(metadata) {
let localizedString =
siteConfig[this.props.language] ?
siteConfig[this.props.language]['localized-strings'][metadata.localized_id] || metadata.title
let localizedString = siteConfig[this.props.language]
? siteConfig[this.props.language]["localized-strings"][
metadata.localized_id
] || metadata.title
: metadata.title;
return localizedString;
@ -74,19 +81,19 @@ class SideNav extends React.Component {
if (metadata.permalink.match(/^https?:/)) {
return metadata.permalink;
}
return siteConfig.baseUrl + metadata.permalink + '#content';
return siteConfig.baseUrl + metadata.permalink + "#content";
}
if (metadata.path) {
return siteConfig.baseUrl + 'blog/' + metadata.path;
return siteConfig.baseUrl + "blog/" + metadata.path;
}
return null;
}
renderItemLink(link) {
const itemClasses = classNames('navListItem', {
navListItemActive: link.id === this.props.current.id,
const itemClasses = classNames("navListItem", {
navListItemActive: link.id === this.props.current.id
});
const linkClasses = classNames('navItem', {
navItemActive: link.id === this.props.current.id,
const linkClasses = classNames("navItem", {
navItemActive: link.id === this.props.current.id
});
return (
<li className={itemClasses} key={link.id}>
@ -98,6 +105,6 @@ class SideNav extends React.Component {
}
}
SideNav.defaultProps = {
contents: [],
contents: []
};
module.exports = SideNav;