10 |
11 | Kick off your project with this default boilerplate. This starter ships with the main Gatsby configuration files you might need to get up and running blazing fast with the blazing fast app generator for React.
12 |
13 | _Have another more specific idea? You may want to check out our vibrant collection of [official and community-created starters](https://www.gatsbyjs.org/docs/gatsby-starters/)._
14 |
15 | ## 🚀 Quick start
16 |
17 | 1. **Create a Gatsby site.**
18 |
19 | Use the Gatsby CLI to create a new site, specifying the default starter.
20 |
21 | ```sh
22 | # create a new Gatsby site using the default starter
23 | npx gatsby new my-default-starter https://github.com/gatsbyjs/gatsby-starter-default
24 | ```
25 |
26 | 1. **Start developing.**
27 |
28 | Navigate into your new site’s directory and start it up.
29 |
30 | ```sh
31 | cd my-default-starter/
32 | gatsby develop
33 | ```
34 |
35 | 1. **Open the source code and start editing!**
36 |
37 | Your site is now running at `http://localhost:8000`!
38 |
39 | \_Note: You'll also see a second link: `http://localhost:8000/___graphql`. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the [Gatsby tutorial](https://www.gatsbyjs.org/tutorial/part-five/#introducing-graphiql).\_
40 |
41 | Open the `my-default-starter` directory in your code editor of choice and edit `src/pages/index.js`. Save your changes and the browser will update in real time!
42 |
43 | ## 🧐 What's inside?
44 |
45 | A quick look at the top-level files and directories you'll see in a Gatsby project.
46 |
47 | .
48 | ├── node_modules
49 | ├── src
50 | ├── .gitignore
51 | ├── .prettierrc
52 | ├── gatsby-browser.js
53 | ├── gatsby-config.js
54 | ├── gatsby-node.js
55 | ├── gatsby-ssr.js
56 | ├── LICENSE
57 | ├── package-lock.json
58 | ├── package.json
59 | └── README.md
60 |
61 | 1. **`/node_modules`**: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed.
62 |
63 | 2. **`/src`**: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. `src` is a convention for “source code”.
64 |
65 | 3. **`.gitignore`**: This file tells git which files it should not track / not maintain a version history for.
66 |
67 | 4. **`.prettierrc`**: This is a configuration file for [Prettier](https://prettier.io/). Prettier is a tool to help keep the formatting of your code consistent.
68 |
69 | 5. **`gatsby-browser.js`**: This file is where Gatsby expects to find any usage of the [Gatsby browser APIs](https://www.gatsbyjs.org/docs/browser-apis/) (if any). These allow customization/extension of default Gatsby settings affecting the browser.
70 |
71 | 6. **`gatsby-config.js`**: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc. (Check out the [config docs](https://www.gatsbyjs.org/docs/gatsby-config/) for more detail).
72 |
73 | 7. **`gatsby-node.js`**: This file is where Gatsby expects to find any usage of the [Gatsby Node APIs](https://www.gatsbyjs.org/docs/node-apis/) (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process.
74 |
75 | 8. **`gatsby-ssr.js`**: This file is where Gatsby expects to find any usage of the [Gatsby server-side rendering APIs](https://www.gatsbyjs.org/docs/ssr-apis/) (if any). These allow customization of default Gatsby settings affecting server-side rendering.
76 |
77 | 9. **`LICENSE`**: Gatsby is licensed under the MIT license.
78 |
79 | 10. **`package-lock.json`** (See `package.json` below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. **(You won’t change this file directly).**
80 |
81 | 11. **`package.json`**: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how npm knows which packages to install for your project.
82 |
83 | 12. **`README.md`**: A text file containing useful reference information about your project.
84 |
85 | ## 🎓 Learning Gatsby
86 |
87 | Looking for more guidance? Full documentation for Gatsby lives [on the website](https://www.gatsbyjs.org/). Here are some places to start:
88 |
89 | - **For most developers, we recommend starting with our [in-depth tutorial for creating a site with Gatsby](https://www.gatsbyjs.org/tutorial/).** It starts with zero assumptions about your level of ability and walks through every step of the process.
90 |
91 | - **To dive straight into code samples, head [to our documentation](https://www.gatsbyjs.org/docs/).** In particular, check out the _Guides_, _API Reference_, and _Advanced Tutorials_ sections in the sidebar.
92 |
93 | ## 💫 Deploy
94 |
95 | [](https://app.netlify.com/start/deploy?repository=https://github.com/gatsbyjs/gatsby-starter-default)
96 |
97 |
98 |
--------------------------------------------------------------------------------
/gatsby-browser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Implement Gatsby's Browser APIs in this file.
3 | *
4 | * See: https://www.gatsbyjs.org/docs/browser-apis/
5 | */
6 |
7 | // You can delete this file if you're not using it
8 |
--------------------------------------------------------------------------------
/gatsby-config.js:
--------------------------------------------------------------------------------
1 | require('dotenv').config({
2 | path: `.env.${process.env.NODE_ENV}`,
3 | })
4 | module.exports = {
5 | siteMetadata: {
6 | title: `Bob's Eatery`,
7 | description: `restaurant site made with gatsby.`,
8 | author: `john`,
9 | },
10 | plugins: [
11 | `gatsby-plugin-react-helmet`,
12 | {
13 | resolve: `gatsby-source-filesystem`,
14 | options: {
15 | name: `images`,
16 | path: `${__dirname}/src/images`,
17 | },
18 | },
19 | `gatsby-transformer-sharp`,
20 | `gatsby-plugin-sharp`,
21 |
22 | `gatsby-plugin-sass`,
23 | `gatsby-plugin-styled-components`,
24 | {
25 | resolve: `gatsby-source-contentful`,
26 | options: {
27 | spaceId: process.env.SPACE_ID,
28 | // Learn about environment variables: https://gatsby.app/env-vars
29 | accessToken: process.env.ACCESS_TOKEN,
30 | },
31 | },
32 | {
33 | resolve: `gatsby-plugin-manifest`,
34 | options: {
35 | name: `gatsby-starter-default`,
36 | short_name: `starter`,
37 | start_url: `/`,
38 | background_color: `#663399`,
39 | theme_color: `#663399`,
40 | display: `minimal-ui`,
41 | icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
42 | },
43 | },
44 | // this (optional) plugin enables Progressive Web App + Offline functionality
45 | // To learn more, visit: https://gatsby.app/offline
46 | // 'gatsby-plugin-offline',
47 | ],
48 | }
49 |
--------------------------------------------------------------------------------
/gatsby-node.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Implement Gatsby's Node APIs in this file.
3 | *
4 | * See: https://www.gatsbyjs.org/docs/node-apis/
5 | */
6 |
7 | // You can delete this file if you're not using it
8 |
--------------------------------------------------------------------------------
/gatsby-ssr.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Implement Gatsby's SSR (Server Side Rendering) APIs in this file.
3 | *
4 | * See: https://www.gatsbyjs.org/docs/ssr-apis/
5 | */
6 |
7 | // You can delete this file if you're not using it
8 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "gatsby-starter-default",
3 | "private": true,
4 | "description": "A simple starter to get up and developing quickly with Gatsby",
5 | "version": "0.1.0",
6 | "author": "Kyle Mathews ",
7 | "dependencies": {
8 | "babel-plugin-styled-components": "^1.10.0",
9 | "dotenv": "^6.2.0",
10 | "gatsby": "^2.20.12",
11 | "gatsby-image": "^2.0.20",
12 | "gatsby-plugin-manifest": "^2.0.9",
13 | "gatsby-plugin-offline": "^2.0.16",
14 | "gatsby-plugin-react-helmet": "^3.0.2",
15 | "gatsby-plugin-sass": "^2.0.7",
16 | "gatsby-plugin-sharp": "^2.5.4",
17 | "gatsby-plugin-styled-components": "^3.0.4",
18 | "gatsby-source-contentful": "^2.0.21",
19 | "gatsby-source-filesystem": "^2.2.2",
20 | "gatsby-transformer-sharp": "^2.1.8",
21 | "node-sass": "^4.13.1",
22 | "prop-types": "^15.6.2",
23 | "react": "^16.6.3",
24 | "react-dom": "^16.6.3",
25 | "react-helmet": "^5.2.0",
26 | "react-icons": "^3.2.2",
27 | "styled-components": "^4.1.3"
28 | },
29 | "keywords": [
30 | "gatsby"
31 | ],
32 | "license": "MIT",
33 | "scripts": {
34 | "build": "gatsby build",
35 | "develop": "gatsby develop",
36 | "start": "npm run develop",
37 | "format": "prettier --write \"src/**/*.js\"",
38 | "test": "echo \"Write tests! -> https://gatsby.app/unit-testing\""
39 | },
40 | "devDependencies": {
41 | "prettier": "^1.15.2"
42 | },
43 | "repository": {
44 | "type": "git",
45 | "url": "https://github.com/gatsbyjs/gatsby-starter-default"
46 | },
47 | "bugs": {
48 | "url": "https://github.com/gatsbyjs/gatsby/issues"
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/components/Global/Footer.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react'
2 | import styled from 'styled-components'
3 | import { styles } from '../../utils'
4 | import { FaInstagram, FaTwitter, FaFacebook } from 'react-icons/fa'
5 | export default class Footer extends Component {
6 | state = {
7 | icons: [
8 | {
9 | id: 1,
10 | icon: ,
11 | path: `https://www.facebook.com`,
12 | },
13 | {
14 | id: 2,
15 | icon: ,
16 | path: `https://www.facebook.com`,
17 | },
18 | {
19 | id: 3,
20 | icon: ,
21 | path: `https://www.facebook.com`,
22 | },
23 | ],
24 | }
25 | render() {
26 | return (
27 |
28 |
13 | Lorem ipsum dolor sit amet consectetur, adipisicing elit. Unde
14 | blanditiis dolorum quae doloremque molestias expedita, eum voluptas
15 | distinctio! Molestiae fuga temporibus nemo non vel mollitia nesciunt
16 | quaerat facere voluptate earum.
17 |
18 |
19 | about
20 |
21 |
22 |
23 | )
24 | }
25 | }
26 |
27 | const QuickInfoWrapper = styled.div`
28 | width: 90%;
29 | margin: 2rem auto;
30 | .text {
31 | line-height: 2em;
32 | color: ${styles.colors.mainGrey};
33 | word-spacing: 0.2rem;
34 | }
35 |
36 | @media (min-width: 768px) {
37 | width: 70%;
38 | }
39 | @media (min-width: 992px) {
40 | width: 60%;
41 | }
42 | `
43 |
--------------------------------------------------------------------------------
/src/components/image.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { StaticQuery, graphql } from 'gatsby'
3 | import Img from 'gatsby-image'
4 |
5 | /*
6 | * This component is built using `gatsby-image` to automatically serve optimized
7 | * images with lazy loading and reduced file sizes. The image is loaded using a
8 | * `StaticQuery`, which allows us to load the image from directly within this
9 | * component, rather than having to pass the image data down from pages.
10 | *
11 | * For more information, see the docs:
12 | * - `gatsby-image`: https://gatsby.app/gatsby-image
13 | * - `StaticQuery`: https://gatsby.app/staticquery
14 | */
15 |
16 | const Image = () => (
17 | }
30 | />
31 | )
32 | export default Image
33 |
--------------------------------------------------------------------------------
/src/components/layout.css:
--------------------------------------------------------------------------------
1 | * {
2 | margin: 0;
3 | padding: 0;
4 | box-sizing: border-box;
5 | }
6 | body {
7 | font-family: 'Caveat', cursive;
8 | }
9 |
--------------------------------------------------------------------------------
/src/components/layout.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | // import styled from 'styled-components'
4 | import { createGlobalStyle } from 'styled-components'
5 | import Navbar from '../components/Global/Navbar'
6 | import Footer from '../components/Global/Footer'
7 | // import '../styles/sass/layout.scss'
8 |
9 | const Layout = ({ children }) => (
10 |