chore: add code formatting and linting (#952)
This commit is contained in:
@ -9,7 +9,7 @@ import Link from 'gatsby-link';
|
||||
*/
|
||||
class TableOfContents extends Component {
|
||||
state = {
|
||||
headings: []
|
||||
headings: [],
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
@ -19,12 +19,12 @@ class TableOfContents extends Component {
|
||||
contentHeadings.forEach(h => {
|
||||
headings.push({
|
||||
id: h.id,
|
||||
text: h.innerText
|
||||
text: h.innerText,
|
||||
});
|
||||
});
|
||||
|
||||
this.setState({
|
||||
headings
|
||||
headings,
|
||||
});
|
||||
}
|
||||
|
||||
@ -52,10 +52,7 @@ const DocsNav = ({ items, location }) => (
|
||||
<ul className="docs-nav-section-list">
|
||||
{item.group.edges.map(({ node }) => (
|
||||
<li className="docs-nav-item" key={node.fields.slug}>
|
||||
<Link
|
||||
to={node.fields.slug}
|
||||
className="nav-link"
|
||||
activeClassName="active">
|
||||
<Link to={node.fields.slug} className="nav-link" activeClassName="active">
|
||||
{node.frontmatter.title}
|
||||
</Link>
|
||||
{location.pathname === node.fields.slug && <TableOfContents />}
|
||||
|
@ -4,7 +4,7 @@ import searchIcon from '../img/search.svg';
|
||||
|
||||
class DocSearch extends Component {
|
||||
state = {
|
||||
enabled: true
|
||||
enabled: true,
|
||||
};
|
||||
componentDidMount() {
|
||||
if (window.docsearch) {
|
||||
@ -12,7 +12,7 @@ class DocSearch extends Component {
|
||||
apiKey: '08d03dc80862e84c70c5a1e769b13019',
|
||||
indexName: 'netlifycms',
|
||||
inputSelector: '.algolia-search',
|
||||
debug: false // Set debug to true if you want to inspect the dropdown
|
||||
debug: false, // Set debug to true if you want to inspect the dropdown
|
||||
});
|
||||
} else {
|
||||
this.setState({ enabled: false });
|
||||
@ -26,11 +26,7 @@ class DocSearch extends Component {
|
||||
return (
|
||||
<a className="utility-input">
|
||||
<img src={searchIcon} />
|
||||
<input
|
||||
type="search"
|
||||
placeholder="Search the docs"
|
||||
className="algolia-search"
|
||||
/>
|
||||
<input type="search" placeholder="Search the docs" className="algolia-search" />
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
@ -3,7 +3,8 @@ import React from 'react';
|
||||
const EditLink = ({ path }) => (
|
||||
<a
|
||||
className="edit-this-page"
|
||||
href={`https://github.com/netlify/netlify-cms/blob/master/website/content/${path}`}>
|
||||
href={`https://github.com/netlify/netlify-cms/blob/master/website/content/${path}`}
|
||||
>
|
||||
<svg
|
||||
version="1.1"
|
||||
id="pencil"
|
||||
@ -15,7 +16,8 @@ const EditLink = ({ path }) => (
|
||||
height="14px"
|
||||
viewBox="0 0 512 512"
|
||||
enableBackground="new 0 0 512 512"
|
||||
xmlSpace="preserve">
|
||||
xmlSpace="preserve"
|
||||
>
|
||||
<path
|
||||
d="M398.875,248.875L172.578,475.187l-22.625-22.625L376.25,226.265L398.875,248.875z M308.375,158.39L82.063,384.687
|
||||
l45.266,45.25L353.625,203.64L308.375,158.39z M263.094,113.125L36.828,339.437l22.625,22.625L285.75,135.765L263.094,113.125z
|
||||
|
@ -4,7 +4,7 @@ import moment from 'moment';
|
||||
class EventWidget extends Component {
|
||||
state = {
|
||||
loading: false,
|
||||
eventDate: ''
|
||||
eventDate: '',
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
@ -14,7 +14,7 @@ class EventWidget extends Component {
|
||||
const url = `https://www.eventbriteapi.com/v3/events/search/?token=${eventbriteToken}&organizer.id=${eventbriteOrganiser}&expand=venue%27`;
|
||||
|
||||
this.setState({
|
||||
loading: true
|
||||
loading: true,
|
||||
});
|
||||
|
||||
fetch(url)
|
||||
@ -24,14 +24,14 @@ class EventWidget extends Component {
|
||||
|
||||
this.setState({
|
||||
loading: false,
|
||||
eventDate
|
||||
eventDate,
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
// TODO: set state to show error message
|
||||
this.setState({
|
||||
loading: false
|
||||
loading: false,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import '../css/imports/header.css';
|
||||
|
||||
class Header extends Component {
|
||||
state = {
|
||||
scrolled: false
|
||||
scrolled: false,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
@ -23,13 +23,12 @@ class Header extends Component {
|
||||
}
|
||||
|
||||
handleScroll = () => {
|
||||
const currentWindowPos =
|
||||
document.documentElement.scrollTop || document.body.scrollTop;
|
||||
const currentWindowPos = document.documentElement.scrollTop || document.body.scrollTop;
|
||||
|
||||
const scrolled = currentWindowPos > 0;
|
||||
|
||||
this.setState({
|
||||
scrolled
|
||||
scrolled,
|
||||
});
|
||||
};
|
||||
|
||||
@ -46,7 +45,7 @@ class Header extends Component {
|
||||
className={classnames({
|
||||
docs: isDocs,
|
||||
blog: isBlog,
|
||||
scrolled
|
||||
scrolled,
|
||||
})}
|
||||
>
|
||||
<div className="contained">
|
||||
@ -60,10 +59,7 @@ class Header extends Component {
|
||||
<Link className="nav-link docs-link" to="/docs/intro">
|
||||
Docs
|
||||
</Link>
|
||||
<Link
|
||||
className="nav-link contributing-link"
|
||||
to="/docs/contributor-guide"
|
||||
>
|
||||
<Link className="nav-link contributing-link" to="/docs/contributor-guide">
|
||||
Contributing
|
||||
</Link>
|
||||
<Link className="nav-link" to="/community">
|
||||
|
@ -2,10 +2,7 @@ import React, { Fragment } from 'react';
|
||||
import Markdown from 'react-markdown';
|
||||
|
||||
const Markdownify = ({ source }) => (
|
||||
<Markdown
|
||||
source={source}
|
||||
renderers={{ root: Fragment, paragraph: Fragment }}
|
||||
/>
|
||||
<Markdown source={source} renderers={{ root: Fragment, paragraph: Fragment }} />
|
||||
);
|
||||
|
||||
export default Markdownify;
|
||||
|
@ -14,10 +14,7 @@ class MobileNav extends Component {
|
||||
{items.map(item => (
|
||||
<optgroup label={item.title} key={item.title}>
|
||||
{item.group.edges.map(({ node }) => (
|
||||
<option
|
||||
value={node.fields.slug}
|
||||
key={node.fields.slug}
|
||||
className="nav-link">
|
||||
<option value={node.fields.slug} key={node.fields.slug} className="nav-link">
|
||||
{node.frontmatter.title}
|
||||
</option>
|
||||
))}
|
||||
|
@ -4,11 +4,11 @@ import screenshotEditor from '../img/screenshot-editor.jpg';
|
||||
|
||||
class VideoEmbed extends Component {
|
||||
state = {
|
||||
toggled: false
|
||||
toggled: false,
|
||||
};
|
||||
toggleVideo = () => {
|
||||
this.setState({
|
||||
toggled: true
|
||||
toggled: true,
|
||||
});
|
||||
};
|
||||
render() {
|
||||
@ -25,9 +25,7 @@ class VideoEmbed extends Component {
|
||||
/>
|
||||
);
|
||||
|
||||
const imgPlaceholder = (
|
||||
<img src={screenshotEditor} className="responsive" />
|
||||
);
|
||||
const imgPlaceholder = <img src={screenshotEditor} className="responsive" />;
|
||||
|
||||
return (
|
||||
<a className="hero-graphic" onClick={this.toggleVideo}>
|
||||
|
@ -5,28 +5,24 @@ import '../css/imports/widgets.css';
|
||||
|
||||
class Widgets extends Component {
|
||||
state = {
|
||||
currentWidget: null
|
||||
currentWidget: null,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
const { widgets } = this.props;
|
||||
|
||||
const hash = window.location.hash
|
||||
? window.location.hash.replace('#', '')
|
||||
: '';
|
||||
const hash = window.location.hash ? window.location.hash.replace('#', '') : '';
|
||||
|
||||
const widgetsContainHash = widgets.edges.some(
|
||||
w => w.node.frontmatter.target === hash
|
||||
);
|
||||
const widgetsContainHash = widgets.edges.some(w => w.node.frontmatter.target === hash);
|
||||
|
||||
if (widgetsContainHash) {
|
||||
return this.setState({
|
||||
currentWidget: hash
|
||||
currentWidget: hash,
|
||||
});
|
||||
}
|
||||
|
||||
this.setState({
|
||||
currentWidget: widgets.edges[0].node.frontmatter.target
|
||||
currentWidget: widgets.edges[0].node.frontmatter.target,
|
||||
});
|
||||
}
|
||||
|
||||
@ -34,11 +30,11 @@ class Widgets extends Component {
|
||||
event.preventDefault();
|
||||
this.setState(
|
||||
{
|
||||
currentWidget: target
|
||||
currentWidget: target,
|
||||
},
|
||||
() => {
|
||||
history.pushState(null, null, `#${target}`);
|
||||
}
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
@ -56,7 +52,7 @@ class Widgets extends Component {
|
||||
<button
|
||||
key={target}
|
||||
className={classnames('widgets__item', {
|
||||
widgets__item_active: currentWidget === target
|
||||
widgets__item_active: currentWidget === target,
|
||||
})}
|
||||
onClick={event => this.handleWidgetChange(event, target)}
|
||||
>
|
||||
@ -72,7 +68,7 @@ class Widgets extends Component {
|
||||
<div
|
||||
key={label}
|
||||
className={classnames('widget', {
|
||||
widget_open: currentWidget === target
|
||||
widget_open: currentWidget === target,
|
||||
})}
|
||||
>
|
||||
<h3>{label}</h3>
|
||||
|
Reference in New Issue
Block a user