From 5b481a36f10bff9327051372e17c176c1d2c3d96 Mon Sep 17 00:00:00 2001 From: Eko Eryanto Date: Fri, 13 Apr 2018 11:24:39 +0700 Subject: [PATCH] feat: add linter --- .eslintrc | 12 + gatsby-config.js | 246 ++++----- gatsby-node.js | 113 ++-- meta/config.js | 36 +- package.json | 11 + src/cms/cms.js | 22 +- src/cms/preview-templates/AboutPagePreview.js | 26 +- src/cms/preview-templates/ArticlePreview.js | 32 +- .../preview-templates/ContactPagePreview.js | 36 +- src/cms/preview-templates/HomePagePreview.js | 44 +- .../preview-templates/PricingPagePreview.js | 42 +- src/components/Contact/index.js | 31 +- src/components/Content/index.js | 10 +- src/components/Disqus/index.js | 70 +-- src/components/Footer/index.js | 30 +- src/components/NavBar/index.js | 72 +-- src/components/Offerings/index.js | 42 +- src/components/PostCard/index.js | 60 +- src/components/Pricing/index.js | 64 +-- src/components/SEO/index.js | 148 ++--- src/components/Share/index.js | 135 +++-- src/components/Testimonials/index.js | 40 +- src/html.js | 81 ++- src/layouts/index.js | 40 +- src/pages/404.js | 36 +- src/pages/blog/index.js | 68 +-- src/pages/tags/index.js | 76 +-- src/templates/about-page.js | 114 ++-- src/templates/article-page.js | 172 +++--- src/templates/contact-page.js | 127 +++-- src/templates/home-page.js | 164 +++--- src/templates/pricing-page.js | 144 ++--- src/templates/tags.js | 74 +-- static/js/toggle.js | 35 +- yarn.lock | 522 +++++++++++++++++- 35 files changed, 1744 insertions(+), 1231 deletions(-) create mode 100644 .eslintrc diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..6338f45 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,12 @@ +{ + "parser": "babel-eslint", + "extends": ["standard", "standard-trailing-commas", "standard-react"], + "globals": { + "graphql": true, + "__PATH_PREFIX__": true + }, + "rules": { + "react/prop-types": "off", + "camelcase": "off" + } +} diff --git a/gatsby-config.js b/gatsby-config.js index 8e7b177..ab3bc02 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,109 +1,109 @@ /** * Created by vaibhav on 31/3/18 */ -const config = require("./meta/config"); +const config = require('./meta/config') -const pathPrefix = config.pathPrefix === "/" ? "" : config.pathPrefix; +const pathPrefix = config.pathPrefix === '/' ? '' : config.pathPrefix module.exports = { - siteMetadata: { - title: config.siteTitle, - siteUrl: config.siteUrl, - rssMetadata: { - site_url: config.siteUrl + pathPrefix, - feed_url: config.siteUrl + pathPrefix + config.siteRss, - title: config.siteTitle, - description: config.siteDescription, - image_url: `${config.siteUrl + pathPrefix}/icons/icon-512x512.png`, - author: config.userName, - copyright: config.copyright - } + siteMetadata: { + title: config.siteTitle, + siteUrl: config.siteUrl, + rssMetadata: { + site_url: config.siteUrl + pathPrefix, + feed_url: config.siteUrl + pathPrefix + config.siteRss, + title: config.siteTitle, + description: config.siteDescription, + image_url: `${config.siteUrl + pathPrefix}/icons/icon-512x512.png`, + author: config.userName, + copyright: config.copyright, }, - plugins: [ - 'gatsby-plugin-react-helmet', - 'gatsby-plugin-sass', - { - resolve: 'gatsby-source-filesystem', - options: { - path: `${__dirname}/src/pages`, - name: 'pages', - }, - }, - { - resolve: `gatsby-plugin-sitemap` - }, - { - resolve: 'gatsby-source-filesystem', - options: { - path: `${__dirname}/src/img`, - name: 'images', - }, - }, - 'gatsby-plugin-sharp', - 'gatsby-transformer-sharp', - { - resolve: 'gatsby-transformer-remark', - options: { - plugins: [], - }, - }, - { - resolve: 'gatsby-plugin-netlify-cms', - options: { - modulePath: `${__dirname}/src/cms/cms.js`, - }, - }, - `gatsby-plugin-offline`, - { - resolve: `gatsby-plugin-nprogress`, - options: { - // Setting a color is optional. - color: config.themeColor, - // Disable the loading spinner. - showSpinner: false, - }, - }, - { - resolve: `gatsby-plugin-google-tagmanager`, - options: { - id: config.googleTagManagerID, - includeInDevelopment: false, - }, - }, - { - resolve: `gatsby-plugin-manifest`, - options: { - name: config.siteTitle, - short_name: config.siteTitleAlt, - start_url: "/", - background_color: config.backgroundColor, - theme_color: config.themeColor, - display: "standalone", - icons: [ - { - src: `/icons/icon-192x192.png`, - sizes: `192x192`, - type: `image/png`, - }, - { - src: `/icons/icon-512x512.png`, - sizes: `512x512`, - type: `image/png`, - }, - ], - }, + }, + plugins: [ + 'gatsby-plugin-react-helmet', + 'gatsby-plugin-sass', + { + resolve: 'gatsby-source-filesystem', + options: { + path: `${__dirname}/src/pages`, + name: 'pages', + }, + }, + { + resolve: `gatsby-plugin-sitemap`, + }, + { + resolve: 'gatsby-source-filesystem', + options: { + path: `${__dirname}/src/img`, + name: 'images', + }, + }, + 'gatsby-plugin-sharp', + 'gatsby-transformer-sharp', + { + resolve: 'gatsby-transformer-remark', + options: { + plugins: [], + }, + }, + { + resolve: 'gatsby-plugin-netlify-cms', + options: { + modulePath: `${__dirname}/src/cms/cms.js`, + }, + }, + `gatsby-plugin-offline`, + { + resolve: `gatsby-plugin-nprogress`, + options: { + // Setting a color is optional. + color: config.themeColor, + // Disable the loading spinner. + showSpinner: false, + }, + }, + { + resolve: `gatsby-plugin-google-tagmanager`, + options: { + id: config.googleTagManagerID, + includeInDevelopment: false, + }, + }, + { + resolve: `gatsby-plugin-manifest`, + options: { + name: config.siteTitle, + short_name: config.siteTitleAlt, + start_url: '/', + background_color: config.backgroundColor, + theme_color: config.themeColor, + display: 'standalone', + icons: [ + { + src: `/icons/icon-192x192.png`, + sizes: `192x192`, + type: `image/png`, + }, + { + src: `/icons/icon-512x512.png`, + sizes: `512x512`, + type: `image/png`, + }, + ], + }, + }, + { + resolve: 'gatsby-plugin-feed', + options: { + setup (ref) { + const ret = ref.query.site.siteMetadata.rssMetadata + ret.allMarkdownRemark = ref.query.allMarkdownRemark + ret.generator = 'GatsbyJS Business Starter' + return ret }, - { - resolve: "gatsby-plugin-feed", - options: { - setup(ref) { - const ret = ref.query.site.siteMetadata.rssMetadata; - ret.allMarkdownRemark = ref.query.allMarkdownRemark; - ret.generator = "GatsbyJS Business Starter"; - return ret; - }, - query: ` + query: ` { site { siteMetadata { @@ -120,24 +120,24 @@ module.exports = { } } `, - feeds: [ - { - serialize(ctx) { - const rssMetadata = ctx.query.site.siteMetadata.rssMetadata; - return ctx.query.allMarkdownRemark.edges - .filter(edge => edge.node.frontmatter.templateKey === 'article-page') - .map(edge => ({ - categories: edge.node.frontmatter.tags, - date: edge.node.frontmatter.date, - title: edge.node.frontmatter.title, - description: edge.node.excerpt, - author: rssMetadata.author, - url: rssMetadata.site_url + edge.node.fields.slug, - guid: rssMetadata.site_url + edge.node.fields.slug, - custom_elements: [{"content:encoded": edge.node.html}] - })); - }, - query: ` + feeds: [ + { + serialize (ctx) { + const rssMetadata = ctx.query.site.siteMetadata.rssMetadata + return ctx.query.allMarkdownRemark.edges + .filter(edge => edge.node.frontmatter.templateKey === 'article-page') + .map(edge => ({ + categories: edge.node.frontmatter.tags, + date: edge.node.frontmatter.date, + title: edge.node.frontmatter.title, + description: edge.node.excerpt, + author: rssMetadata.author, + url: rssMetadata.site_url + edge.node.fields.slug, + guid: rssMetadata.site_url + edge.node.fields.slug, + custom_elements: [{'content:encoded': edge.node.html}], + })) + }, + query: ` { allMarkdownRemark( limit: 1000, @@ -161,12 +161,12 @@ module.exports = { } } `, - output: config.siteRss - } - ] - } - }, - 'gatsby-plugin-netlify' - ], -}; + output: config.siteRss, + }, + ], + }, + }, + 'gatsby-plugin-netlify', + ], +} diff --git a/gatsby-node.js b/gatsby-node.js index 19d05be..f61e4a5 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -1,15 +1,14 @@ /** * Created by vaibhav on 31/3/18 */ -const _ = require('lodash'); -const path = require('path'); -const { createFilePath } = require('gatsby-source-filesystem'); - +const _ = require('lodash') +const path = require('path') +const { createFilePath } = require('gatsby-source-filesystem') exports.createPages = ({ boundActionCreators, graphql }) => { - const { createPage } = boundActionCreators + const { createPage } = boundActionCreators - return graphql(` + return graphql(` { allMarkdownRemark(limit: 1000) { edges { @@ -27,63 +26,63 @@ exports.createPages = ({ boundActionCreators, graphql }) => { } } `).then(result => { - if (result.errors) { - result.errors.forEach(e => console.error(e.toString())); - return Promise.reject(result.errors) - } + if (result.errors) { + result.errors.forEach(e => console.error(e.toString())) + return Promise.reject(result.errors) + } - const posts = result.data.allMarkdownRemark.edges; + const posts = result.data.allMarkdownRemark.edges - posts.forEach(edge => { - const id = edge.node.id; - createPage({ - path: edge.node.fields.slug, - tags: edge.node.frontmatter.tags, - component: path.resolve( - `src/templates/${String(edge.node.frontmatter.templateKey)}.js` - ), - // additional data can be passed via context - context: { - id, - }, - }) - }); + posts.forEach(edge => { + const id = edge.node.id + createPage({ + path: edge.node.fields.slug, + tags: edge.node.frontmatter.tags, + component: path.resolve( + `src/templates/${String(edge.node.frontmatter.templateKey)}.js` + ), + // additional data can be passed via context + context: { + id, + }, + }) + }) - // Tag pages: - let tags = []; - // Iterate through each post, putting all found tags into `tags` - posts.forEach(edge => { - if (_.get(edge, `node.frontmatter.tags`)) { - tags = tags.concat(edge.node.frontmatter.tags) - } - }); - // Eliminate duplicate tags - tags = _.uniq(tags); + // Tag pages: + let tags = [] + // Iterate through each post, putting all found tags into `tags` + posts.forEach(edge => { + if (_.get(edge, `node.frontmatter.tags`)) { + tags = tags.concat(edge.node.frontmatter.tags) + } + }) + // Eliminate duplicate tags + tags = _.uniq(tags) - // Make tag pages - tags.forEach(tag => { - const tagPath = `/tags/${_.kebabCase(tag)}/`; + // Make tag pages + tags.forEach(tag => { + const tagPath = `/tags/${_.kebabCase(tag)}/` - createPage({ - path: tagPath, - component: path.resolve(`src/templates/tags.js`), - context: { - tag, - }, - }) - }) + createPage({ + path: tagPath, + component: path.resolve(`src/templates/tags.js`), + context: { + tag, + }, + }) }) -}; + }) +} exports.onCreateNode = ({ node, boundActionCreators, getNode }) => { - const { createNodeField } = boundActionCreators + const { createNodeField } = boundActionCreators - if (node.internal.type === `MarkdownRemark`) { - const value = createFilePath({ node, getNode }) - createNodeField({ - name: `slug`, - node, - value, - }) - } -}; + if (node.internal.type === `MarkdownRemark`) { + const value = createFilePath({ node, getNode }) + createNodeField({ + name: `slug`, + node, + value, + }) + } +} diff --git a/meta/config.js b/meta/config.js index 2c3cdcc..0827595 100644 --- a/meta/config.js +++ b/meta/config.js @@ -2,21 +2,21 @@ * Created by vaibhav on 31/3/18 */ module.exports = { - siteTitle: "Gatsby Starter Business", // Site title. - siteTitleAlt: "Business", // Alternative site title for SEO. - siteLogo: "/logos/logo-512x512.png", // Logo used for SEO and manifest. - siteUrl: "https://gatsby-starter-business.netlify.com", // Domain of your website without pathPrefix. - pathPrefix: "/", // Prefixes all links. For cases when deployed to example.github.io/gatsby-starter-business/. - siteDescription: "Leverage Gatsby Business Starter for your Business.", // Website description used for RSS feeds/meta description tag. - siteRss: "/rss.xml", - siteFBAppID: "", // FB Application ID for using app insights - googleTagManagerID: "", // GTM tracking ID. - disqusShortname: "gatsby-business-starter", // Disqus shortname. - userName: "Vaibhav Sharma", - userTwitter: "vaibhaved", - userLocation: "Delhi NCR, India", - userDescription: "", - copyright: "Copyright © Gatsby Starter Business 2018. All Rights Reserved.", // Copyright string for the footer of the website and RSS feed. - themeColor: "#00d1b2", // Used for setting manifest and progress theme colors. - backgroundColor: "#ffffff" // Used for setting manifest background color. -}; \ No newline at end of file + siteTitle: 'Gatsby Starter Business', // Site title. + siteTitleAlt: 'Business', // Alternative site title for SEO. + siteLogo: '/logos/logo-512x512.png', // Logo used for SEO and manifest. + siteUrl: 'https://gatsby-starter-business.netlify.com', // Domain of your website without pathPrefix. + pathPrefix: '/', // Prefixes all links. For cases when deployed to example.github.io/gatsby-starter-business/. + siteDescription: 'Leverage Gatsby Business Starter for your Business.', // Website description used for RSS feeds/meta description tag. + siteRss: '/rss.xml', + siteFBAppID: '', // FB Application ID for using app insights + googleTagManagerID: '', // GTM tracking ID. + disqusShortname: 'gatsby-business-starter', // Disqus shortname. + userName: 'Vaibhav Sharma', + userTwitter: 'vaibhaved', + userLocation: 'Delhi NCR, India', + userDescription: '', + copyright: 'Copyright © Gatsby Starter Business 2018. All Rights Reserved.', // Copyright string for the footer of the website and RSS feed. + themeColor: '#00d1b2', // Used for setting manifest and progress theme colors. + backgroundColor: '#ffffff', // Used for setting manifest background color. +} diff --git a/package.json b/package.json index 395c62c..0c3e5f7 100644 --- a/package.json +++ b/package.json @@ -36,10 +36,21 @@ "build": "gatsby build", "develop": "gatsby develop", "serve": "gatsby serve", + "lint": "eslint --ext js,jsx --ignore-path .gitignore .", "format": "prettier --trailing-comma es5 --no-semi --single-quote --write \"{gatsby-*.js,src/**/*.js}\"", "test": "echo \"Error: no test specified\" && exit 1" }, "devDependencies": { + "babel-eslint": "^8.2.2", + "eslint": "^4.19.1", + "eslint-config-standard": "^11.0.0", + "eslint-config-standard-react": "^6.0.0", + "eslint-config-standard-trailing-commas": "^6.1.0", + "eslint-plugin-import": "^2.10.0", + "eslint-plugin-node": "^6.0.1", + "eslint-plugin-promise": "^3.7.0", + "eslint-plugin-react": "^7.7.0", + "eslint-plugin-standard": "^3.0.1", "prettier": "^1.7.4" } } diff --git a/src/cms/cms.js b/src/cms/cms.js index 5e41665..f727e81 100644 --- a/src/cms/cms.js +++ b/src/cms/cms.js @@ -3,15 +3,15 @@ */ import CMS from 'netlify-cms' -import HomePagePreview from "./preview-templates/HomePagePreview"; -import AboutPagePreview from './preview-templates/AboutPagePreview'; -import ArticlePreview from './preview-templates/ArticlePreview'; -import PricingPagePreview from './preview-templates/PricingPagePreview'; -import ContactPagePreview from "./preview-templates/ContactPagePreview"; +import HomePagePreview from './preview-templates/HomePagePreview' +import AboutPagePreview from './preview-templates/AboutPagePreview' +import ArticlePreview from './preview-templates/ArticlePreview' +import PricingPagePreview from './preview-templates/PricingPagePreview' +import ContactPagePreview from './preview-templates/ContactPagePreview' -CMS.registerPreviewStyle('/styles.css'); -CMS.registerPreviewTemplate('home', HomePagePreview); -CMS.registerPreviewTemplate('about', AboutPagePreview); -CMS.registerPreviewTemplate('pricing', PricingPagePreview); -CMS.registerPreviewTemplate('contact', ContactPagePreview); -CMS.registerPreviewTemplate('blog', ArticlePreview); +CMS.registerPreviewStyle('/styles.css') +CMS.registerPreviewTemplate('home', HomePagePreview) +CMS.registerPreviewTemplate('about', AboutPagePreview) +CMS.registerPreviewTemplate('pricing', PricingPagePreview) +CMS.registerPreviewTemplate('contact', ContactPagePreview) +CMS.registerPreviewTemplate('blog', ArticlePreview) diff --git a/src/cms/preview-templates/AboutPagePreview.js b/src/cms/preview-templates/AboutPagePreview.js index b16fa65..3f3e42d 100644 --- a/src/cms/preview-templates/AboutPagePreview.js +++ b/src/cms/preview-templates/AboutPagePreview.js @@ -6,19 +6,19 @@ import PropTypes from 'prop-types' import { AboutPageTemplate } from '../../templates/about-page' const AboutPagePreview = ({ entry, widgetFor }) => ( - -); + +) AboutPagePreview.propTypes = { - entry: PropTypes.shape({ - getIn: PropTypes.func, - }), - widgetFor: PropTypes.func, -}; + entry: PropTypes.shape({ + getIn: PropTypes.func, + }), + widgetFor: PropTypes.func, +} -export default AboutPagePreview; \ No newline at end of file +export default AboutPagePreview diff --git a/src/cms/preview-templates/ArticlePreview.js b/src/cms/preview-templates/ArticlePreview.js index b6cfc4c..c73f074 100644 --- a/src/cms/preview-templates/ArticlePreview.js +++ b/src/cms/preview-templates/ArticlePreview.js @@ -6,22 +6,22 @@ import PropTypes from 'prop-types' import {ArticleTemplate} from '../../templates/article-page' const ArticlePreview = ({entry, widgetFor}) => ( - -); + +) ArticlePreview.propTypes = { - entry: PropTypes.shape({ - getIn: PropTypes.func, - }), - widgetFor: PropTypes.func, -}; + entry: PropTypes.shape({ + getIn: PropTypes.func, + }), + widgetFor: PropTypes.func, +} -export default ArticlePreview; +export default ArticlePreview diff --git a/src/cms/preview-templates/ContactPagePreview.js b/src/cms/preview-templates/ContactPagePreview.js index cb16f96..ad870de 100644 --- a/src/cms/preview-templates/ContactPagePreview.js +++ b/src/cms/preview-templates/ContactPagePreview.js @@ -6,25 +6,25 @@ import PropTypes from 'prop-types' import { ContactPageTemplate } from '../../templates/contact-page' const ContactPagePreview = ({ entry, getAsset }) => { - const entryContacts = entry.getIn(['data', 'contacts']); - const contacts = entryContacts ? entryContacts.toJS() : []; + const entryContacts = entry.getIn(['data', 'contacts']) + const contacts = entryContacts ? entryContacts.toJS() : [] - return ( - - ) -}; + return ( + + ) +} ContactPagePreview.propTypes = { - entry: PropTypes.shape({ - getIn: PropTypes.func, - }), - getAsset: PropTypes.func, -}; + entry: PropTypes.shape({ + getIn: PropTypes.func, + }), + getAsset: PropTypes.func, +} -export default ContactPagePreview; +export default ContactPagePreview diff --git a/src/cms/preview-templates/HomePagePreview.js b/src/cms/preview-templates/HomePagePreview.js index 5276e4d..e3e6fde 100644 --- a/src/cms/preview-templates/HomePagePreview.js +++ b/src/cms/preview-templates/HomePagePreview.js @@ -6,30 +6,30 @@ import PropTypes from 'prop-types' import { HomePageTemplate } from '../../templates/home-page' const HomePagePreview = ({ entry, getAsset }) => { - const entryBlurbs = entry.getIn(['data', 'offerings', 'blurbs']); - const blurbs = entryBlurbs ? entryBlurbs.toJS() : []; + const entryBlurbs = entry.getIn(['data', 'offerings', 'blurbs']) + const blurbs = entryBlurbs ? entryBlurbs.toJS() : [] - const entryTestimonials = entry.getIn(['data', 'testimonials']); - const testimonials = entryTestimonials ? entryTestimonials.toJS() : []; + const entryTestimonials = entry.getIn(['data', 'testimonials']) + const testimonials = entryTestimonials ? entryTestimonials.toJS() : [] - return ( - - ) -}; + return ( + + ) +} HomePagePreview.propTypes = { - entry: PropTypes.shape({ - getIn: PropTypes.func, - }), - getAsset: PropTypes.func, -}; + entry: PropTypes.shape({ + getIn: PropTypes.func, + }), + getAsset: PropTypes.func, +} -export default HomePagePreview; +export default HomePagePreview diff --git a/src/cms/preview-templates/PricingPagePreview.js b/src/cms/preview-templates/PricingPagePreview.js index 007c4f5..8ef9789 100644 --- a/src/cms/preview-templates/PricingPagePreview.js +++ b/src/cms/preview-templates/PricingPagePreview.js @@ -6,28 +6,28 @@ import PropTypes from 'prop-types' import { PricingPageTemplate } from '../../templates/pricing-page' const PricingPagePreivew = ({ entry, getAsset }) => { - const entryPricingPlans = entry.getIn(['data', 'pricing', 'plans']); - const pricingPlans = entryPricingPlans ? entryPricingPlans.toJS() : []; + const entryPricingPlans = entry.getIn(['data', 'pricing', 'plans']) + const pricingPlans = entryPricingPlans ? entryPricingPlans.toJS() : [] - return ( - - ) -}; + return ( + + ) +} PricingPagePreivew.propTypes = { - entry: PropTypes.shape({ - getIn: PropTypes.func, - }), - getAsset: PropTypes.func, -}; + entry: PropTypes.shape({ + getIn: PropTypes.func, + }), + getAsset: PropTypes.func, +} -export default PricingPagePreivew; +export default PricingPagePreivew diff --git a/src/components/Contact/index.js b/src/components/Contact/index.js index 508284e..faddc2f 100644 --- a/src/components/Contact/index.js +++ b/src/components/Contact/index.js @@ -1,24 +1,23 @@ /** * Created by vaibhav on 2/4/18 */ -import React from 'react'; -import PropTypes from 'prop-types'; +import React from 'react' +import PropTypes from 'prop-types' const Contact = ({email, description}) => { - return ( -
-

{email}

-

{description}

-
- ); -}; + return ( +
+

{email}

+

{description}

+
+ ) +} Contact.propTypes = { - email: PropTypes.string.isRequired, - description: PropTypes.string, -}; + email: PropTypes.string.isRequired, + description: PropTypes.string, +} - -export default Contact \ No newline at end of file +export default Contact diff --git a/src/components/Content/index.js b/src/components/Content/index.js index 086c1d9..d4519e4 100644 --- a/src/components/Content/index.js +++ b/src/components/Content/index.js @@ -5,18 +5,18 @@ import React from 'react' import PropTypes from 'prop-types' export const HTMLContent = ({ content, className }) => ( -
+
) const Content = ({ content, className }) => ( -
{content}
+
{content}
) Content.propTypes = { - content: PropTypes.string, - className: PropTypes.string, + content: PropTypes.string, + className: PropTypes.string, } HTMLContent.propTypes = Content.propTypes -export default Content \ No newline at end of file +export default Content diff --git a/src/components/Disqus/index.js b/src/components/Disqus/index.js index 35cba74..4434241 100644 --- a/src/components/Disqus/index.js +++ b/src/components/Disqus/index.js @@ -1,47 +1,47 @@ /** * Created by vaibhav on 1/4/18 */ -import React, {Component} from "react"; -import ReactDisqusComments from "react-disqus-comments"; -import config from "../../../meta/config"; +import React, {Component} from 'react' +import ReactDisqusComments from 'react-disqus-comments' +import config from '../../../meta/config' class Disqus extends Component { - constructor(props) { - super(props); - this.state = { - toasts: [] - }; - this.notifyAboutComment = this.notifyAboutComment.bind(this); - this.onSnackbarDismiss = this.onSnackbarDismiss.bind(this); + constructor (props) { + super(props) + this.state = { + toasts: [], } + this.notifyAboutComment = this.notifyAboutComment.bind(this) + this.onSnackbarDismiss = this.onSnackbarDismiss.bind(this) + } - onSnackbarDismiss() { - const [, ...toasts] = this.state.toasts; - this.setState({toasts}); - } + onSnackbarDismiss () { + const [, ...toasts] = this.state.toasts + this.setState({toasts}) + } - notifyAboutComment() { - const toasts = this.state.toasts.slice(); - toasts.push({text: "New comment available!"}); - this.setState({toasts}); - } + notifyAboutComment () { + const toasts = this.state.toasts.slice() + toasts.push({text: 'New comment available!'}) + this.setState({toasts}) + } - render() { - const {title, slug} = this.props; - if (!config.disqusShortname) { - return null; - } - const url = config.siteUrl + config.pathPrefix + slug; - return ( - - ); + render () { + const {title, slug} = this.props + if (!config.disqusShortname) { + return null } + const url = config.siteUrl + config.pathPrefix + slug + return ( + + ) + } } -export default Disqus; \ No newline at end of file +export default Disqus diff --git a/src/components/Footer/index.js b/src/components/Footer/index.js index f425d2c..6d3ee49 100644 --- a/src/components/Footer/index.js +++ b/src/components/Footer/index.js @@ -1,21 +1,21 @@ /** * Created by vaibhav on 31/3/18 */ -import React from 'react'; -import config from '../../../meta/config'; +import React from 'react' +import config from '../../../meta/config' const Footer = () => { - return ( -
-
-
-

- {config.copyright} -

-
-
-
- ); -}; + return ( +
+
+
+

+ {config.copyright} +

+
+
+
+ ) +} -export default Footer; \ No newline at end of file +export default Footer diff --git a/src/components/NavBar/index.js b/src/components/NavBar/index.js index 9fcfd86..d5d68ce 100644 --- a/src/components/NavBar/index.js +++ b/src/components/NavBar/index.js @@ -5,46 +5,46 @@ import React from 'react' import Link from 'gatsby-link' const NavBar = () => { - return ( -
+
+ + ) +} -export default NavBar; \ No newline at end of file +export default NavBar diff --git a/src/components/Offerings/index.js b/src/components/Offerings/index.js index 1e5df29..bd70b42 100644 --- a/src/components/Offerings/index.js +++ b/src/components/Offerings/index.js @@ -5,27 +5,27 @@ import React from 'react' import PropTypes from 'prop-types' const Offerings = ({ gridItems }) => ( -
- {gridItems.map(item => ( -
-
-

- -

-

{item.text}

-
-
- ))} -
-); +
+ {gridItems.map(item => ( +
+
+

+ +

+

{item.text}

+
+
+ ))} +
+) Offerings.propTypes = { - gridItems: PropTypes.arrayOf( - PropTypes.shape({ - image: PropTypes.string, - text: PropTypes.string, - }) - ), -}; + gridItems: PropTypes.arrayOf( + PropTypes.shape({ + image: PropTypes.string, + text: PropTypes.string, + }) + ), +} -export default Offerings; +export default Offerings diff --git a/src/components/PostCard/index.js b/src/components/PostCard/index.js index 23bfd6e..062267b 100644 --- a/src/components/PostCard/index.js +++ b/src/components/PostCard/index.js @@ -5,35 +5,35 @@ import React from 'react' import Link from 'gatsby-link' const PostCard = ({posts}) => { - return ( -
- {posts - .filter(post => post.node.frontmatter.templateKey === 'article-page') - .map(({node: post}) => ( -
-

- - {post.frontmatter.title} - - - {post.frontmatter.date} -

-

- {post.excerpt} -
-
- + return ( +

+ {posts + .filter(post => post.node.frontmatter.templateKey === 'article-page') + .map(({node: post}) => ( +
+

+ + {post.frontmatter.title} + + + {post.frontmatter.date} +

+

+ {post.excerpt} +
+
+ Keep Reading → - -

-
- ))} -
- ); -}; + +

+
+ ))} +
+ ) +} -export default PostCard \ No newline at end of file +export default PostCard diff --git a/src/components/Pricing/index.js b/src/components/Pricing/index.js index 9a2bc7a..5573d3a 100644 --- a/src/components/Pricing/index.js +++ b/src/components/Pricing/index.js @@ -5,39 +5,39 @@ import React from 'react' import PropTypes from 'prop-types' const Pricing = ({ data }) => ( -
- {data.map(price => ( -
-
-

- {price.plan} -

-

+
+ {data.map(price => ( +
+
+

+ {price.plan} +

+

${price.price} -

-

{price.description}

-
    - {price.items.map(item => ( -
  • - {item} -
  • - ))} -
-
-
- ))} -
-); +

+

{price.description}

+
    + {price.items.map(item => ( +
  • + {item} +
  • + ))} +
+
+
+ ))} +
+) Pricing.propTypes = { - data: PropTypes.arrayOf( - PropTypes.shape({ - plan: PropTypes.string, - price: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), - description: PropTypes.string, - items: PropTypes.array, - }) - ), -}; + data: PropTypes.arrayOf( + PropTypes.shape({ + plan: PropTypes.string, + price: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), + description: PropTypes.string, + items: PropTypes.array, + }) + ), +} -export default Pricing; +export default Pricing diff --git a/src/components/SEO/index.js b/src/components/SEO/index.js index 4830f5e..c04d3c6 100644 --- a/src/components/SEO/index.js +++ b/src/components/SEO/index.js @@ -2,86 +2,86 @@ * Created by vaibhav on 31/3/18 */ import React from 'react' -import config from "../../../meta/config"; +import config from '../../../meta/config' import Helmet from 'react-helmet' const SE0 = ({title, meta_title, meta_desc, cover, slug}) => { - let postURL = config.siteUrl + slug - const realPrefix = config.pathPrefix === "/" ? "" : config.pathPrefix - let image = config.siteUrl + realPrefix + cover - const blogURL = config.siteUrl + config.pathPrefix - const schemaOrgJSONLD = [ - { - "@context": "http://schema.org", - "@type": "WebSite", - url: blogURL, - name: title, - alternateName: config.siteTitleAlt ? config.siteTitleAlt : "" - } - ]; + let postURL = config.siteUrl + slug + const realPrefix = config.pathPrefix === '/' ? '' : config.pathPrefix + let image = config.siteUrl + realPrefix + cover + const blogURL = config.siteUrl + config.pathPrefix + const schemaOrgJSONLD = [ + { + '@context': 'http://schema.org', + '@type': 'WebSite', + url: blogURL, + name: title, + alternateName: config.siteTitleAlt ? config.siteTitleAlt : '', + }, + ] - schemaOrgJSONLD.push([ + schemaOrgJSONLD.push([ + { + '@context': 'http://schema.org', + '@type': 'BreadcrumbList', + itemListElement: [ { - "@context": "http://schema.org", - "@type": "BreadcrumbList", - itemListElement: [ - { - "@type": "ListItem", - position: 1, - item: { - "@id": postURL, - name: title, - image - } - } - ] - }, - { - "@context": "http://schema.org", - "@type": "BlogPosting", - url: blogURL, + '@type': 'ListItem', + position: 1, + item: { + '@id': postURL, name: title, - alternateName: config.siteTitleAlt ? config.siteTitleAlt : "", - headline: title, - image: { - "@type": "ImageObject", - url: image - }, - meta_desc - } - ]); + image, + }, + }, + ], + }, + { + '@context': 'http://schema.org', + '@type': 'BlogPosting', + url: blogURL, + name: title, + alternateName: config.siteTitleAlt ? config.siteTitleAlt : '', + headline: title, + image: { + '@type': 'ImageObject', + url: image, + }, + meta_desc, + }, + ]) - return ( - - {meta_title} - {/* General tags */} - - - {/* Schema.org tags */} - - {/* OpenGraph tags */} - - - - - - - {/* Twitter Card tags */} - - - - - - - ) + return ( + + {meta_title} + {/* General tags */} + + + {/* Schema.org tags */} + + {/* OpenGraph tags */} + + + + + + + {/* Twitter Card tags */} + + + + + + + ) } -export default SE0 \ No newline at end of file +export default SE0 diff --git a/src/components/Share/index.js b/src/components/Share/index.js index 49016f1..e53d313 100644 --- a/src/components/Share/index.js +++ b/src/components/Share/index.js @@ -1,76 +1,73 @@ -import React, {Component} from "react"; +import React, {Component} from 'react' import { - ShareButtons, - ShareCounts, - generateShareIcon, - FacebookShareButton, - GooglePlusShareButton, - LinkedinShareButton, - TwitterShareButton, - TelegramShareButton, - RedditShareButton, - FacebookShareCount, - GooglePlusShareCount, - LinkedinShareCount, - RedditShareCount, - FacebookIcon, - TwitterIcon, - TelegramIcon, - GooglePlusIcon, - LinkedinIcon, - RedditIcon -} from "react-share"; -import config from "../../../meta/config"; -import "./styles.sass"; + FacebookShareButton, + GooglePlusShareButton, + LinkedinShareButton, + TwitterShareButton, + TelegramShareButton, + RedditShareButton, + FacebookShareCount, + GooglePlusShareCount, + LinkedinShareCount, + RedditShareCount, + FacebookIcon, + TwitterIcon, + TelegramIcon, + GooglePlusIcon, + LinkedinIcon, + RedditIcon, +} from 'react-share' +import config from '../../../meta/config' +import './styles.sass' class Share extends Component { - render() { - const {title, slug, excerpt, mobile} = this.props; - const realPrefix = config.pathPrefix === "/" ? "" : config.pathPrefix; - const url = config.siteUrl + realPrefix + slug; + render () { + const {title, slug, excerpt, mobile} = this.props + const realPrefix = config.pathPrefix === '/' ? '' : config.pathPrefix + const url = config.siteUrl + realPrefix + slug - const iconSize = mobile ? 36 : 48; - const filter = count => (count > 0 ? count : ""); + const iconSize = mobile ? 36 : 48 + const filter = count => (count > 0 ? count : '') - return ( -
- - - - {count =>
{filter(count)}
} -
-
- - - - - - - {count =>
{filter(count)}
} -
-
- - - - {count =>
{filter(count)}
} -
-
- - - - {count =>
{filter(count)}
} -
-
- - - -
- ); - } + return ( +
+ + + + {count =>
{filter(count)}
} +
+
+ + + + + + + {count =>
{filter(count)}
} +
+
+ + + + {count =>
{filter(count)}
} +
+
+ + + + {count =>
{filter(count)}
} +
+
+ + + +
+ ) + } } -export default Share; +export default Share diff --git a/src/components/Testimonials/index.js b/src/components/Testimonials/index.js index 799d19f..567ebef 100644 --- a/src/components/Testimonials/index.js +++ b/src/components/Testimonials/index.js @@ -5,26 +5,26 @@ import React from 'react' import PropTypes from 'prop-types' const Testimonials = ({testimonials}) => ( -
- {testimonials.map((testimonial, id) => ( -
-
- {testimonial.quote} -
- – {testimonial.author} -
-
- ))} -
-); +
+ {testimonials.map((testimonial, id) => ( +
+
+ {testimonial.quote} +
+ – {testimonial.author} +
+
+ ))} +
+) Testimonials.propTypes = { - testimonials: PropTypes.arrayOf( - PropTypes.shape({ - quote: PropTypes.string, - author: PropTypes.string, - }) - ), -}; + testimonials: PropTypes.arrayOf( + PropTypes.shape({ + quote: PropTypes.string, + author: PropTypes.string, + }) + ), +} -export default Testimonials; \ No newline at end of file +export default Testimonials diff --git a/src/html.js b/src/html.js index 5234b98..df453eb 100644 --- a/src/html.js +++ b/src/html.js @@ -1,50 +1,49 @@ /** * Created by vaibhav on 31/3/18 */ -import React, {Component} from "react"; +import React, {Component} from 'react' import favicon from './img/favicon.ico' -import {withPrefix} from 'gatsby-link'; -let inlinedStyles = ""; -if (process.env.NODE_ENV === "production") { - try { - /* eslint import/no-webpack-loader-syntax: off */ - inlinedStyles = require("!raw-loader!../public/styles.css"); - } catch (e) { - /* eslint no-console: "off"*/ - console.log(e); - } +let inlinedStyles = '' +if (process.env.NODE_ENV === 'production') { + try { + /* eslint import/no-webpack-loader-syntax: off */ + inlinedStyles = require('!raw-loader!../public/styles.css') + } catch (e) { + /* eslint no-console: "off" */ + console.log(e) + } } export default class HTML extends Component { - render() { - let css; - if (process.env.NODE_ENV === "production") { - css = ( -