README IS IN PROGRESS
- If you're comfortable with creating HTML/CSS/JS static webpages and is currently learning ReactJS. I hope you appreciate what GatsbyJS is capable of after reading.
- Product inventory is managed using the DatoCMS dashboard
- Fully responsive minimalistic design
- And last but not least, dark mode 🌛!
I will walk you through how to make this site yours. You'll have your own online store in no time!
- Create a new project
gatsby new gatsby-simplefolio https://github.com/masayaShinoda/gatsbyjs-datocms-snipcart
- Changing site information
- Information such as the site title and description is stored in
gatsby-config.js
module.exports = { siteMetadata: { title: `Test E-commerce Project`, description: `E-commerce site built with GatsbyJS and DatoCMS.`, author: `Masaya`, },
gatsby-plugin-manifest
plugin allows users to add your site to their home screen on most mobile browsers. Modify the code according to your need.{ resolve: `gatsby-plugin-manifest`, options: { name: `Masaya Store`, short_name: `Masaya Store`, start_url: `/`, background_color: `#3a2a8a`, theme_color: `#3a2a8a`, display: `Masaya Store`, icon: `src/images/logo-03.png`, }, },
- Accessing DatoCMS data:
- Follow the official DatoCMS documentation for how to integrate with GatsbyJS
- Once you've changed the API Token in
gatsby-config.js
,—you would want to query and render your own content (in this case, products) instead of mine.{ resolve: `gatsby-source-datocms`, options: { apiToken: `YOUR API TOKEN`, preview: false, disableLiveReload: false, }, },
- Here's how the product listing works in this website:
* Products are queried using GraphQL's
useStaticQuery
found on line 10 of.\src\components\products.js
:const productData = useStaticQuery(graphql` query productData { allDatoCmsProduct { nodes { productType productModel brand colorS sizes price displayimg { url } images { url alt } id } } } `)
- While in development mode, navigate to
localhost:8000/_graphql
to see your personal DatoCMS nodes. In my case, my DatoCMSModel
isProduct
and the fields can be queried by:query productData { allDatoCmsProduct { nodes { // YOUR FIELDS } } }