1.6.0 ā€¢ Published 5 years ago

@moltin/gatsby-theme-moltin v1.6.0

Weekly downloads
8
License
MIT
Repository
github
Last release
5 years ago

gatsby-theme-moltin

šŸ› Gatsby theme for building Moltin powered eCommerce websites.

Install

yarn add @moltin/gatsby-theme-moltin

How to use

// In your gatsby-config.js
plugins: [
  {
    resolve: `@moltin/gatsby-theme-moltin`,
    options: {
      clientId: '...',
      // See additional options below
    },
  },
]

Options

OptionDefaultRequiredDescription
clientIdnullYesYour Moltin Client ID
basePath/NoUseful if you wish to mount your store at /store
productsPathproductsNoChange the path to products
collectionsPathcollectionsNoChange the path to collections
categoriesPathcategoriesNoChange the path to categories
brandsPathbrandsNoChange the path to brands

Component shadowing

You can use Gatsby component shadowing to change the behaviour/appearance of components.

If you wanted to change the default /categories page, you could create the following file inside your Gatsby project.

// src/@moltin/gatsby-theme-moltin/components/CategorySection

import React from 'react'
import { Link } from 'gatsby'

import { ProductGrid } from '@moltin/gatsby-theme-moltin'

const CatalogSection = ({ id, path, name, description, products }) => {
  return (
    <section key={id}>
      <h2>
        <Link to={path}>{name}</Link>
      </h2>
      <p>{description}</p>

      <ProductGrid products={products} />
    </section>
  )
}

export default CatalogSection