├── .gitignore ├── README.md ├── package.json ├── packages ├── gatsby-theme-west-egg-blog │ ├── gatsby-config.js │ ├── index.js │ ├── package.json │ └── src │ │ ├── components │ │ └── posts-page-layout.js │ │ └── pages │ │ └── index.mdx ├── gatsby-theme-west-egg-core │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc.js │ ├── gatsby-config.js │ ├── gatsby-node.js │ ├── index.js │ ├── package.json │ ├── src │ │ ├── @types │ │ │ └── gatsby-theme-west-egg-core │ │ │ │ └── index.d.ts │ │ ├── components │ │ │ └── SEO.tsx │ │ └── utils │ │ │ └── Utilities.ts │ └── tsconfig.json ├── gatsby-theme-west-egg-sanity │ ├── package.json │ └── sanity-studio │ │ ├── README.md │ │ ├── config │ │ ├── .checksums │ │ └── @sanity │ │ │ └── data-aspects.json │ │ ├── package.json │ │ ├── plugins │ │ └── .gitkeep │ │ ├── sanity.json │ │ ├── schemas │ │ ├── author.js │ │ ├── blockContent.js │ │ ├── category.js │ │ ├── post.js │ │ └── schema.js │ │ └── static │ │ ├── .gitkeep │ │ └── favicon.ico ├── gatsby-theme-west-egg-stripe-cart │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc.js │ ├── README.md │ ├── gatsby-config.js │ ├── index.js │ ├── package.json │ ├── src │ │ ├── @types │ │ │ └── gatsby-theme-west-egg-stripe-cart │ │ │ │ └── index.d.ts │ │ ├── components │ │ │ └── StripeCheckout.tsx │ │ ├── pages │ │ │ └── checkout │ │ │ │ ├── canceled.tsx │ │ │ │ └── success.tsx │ │ └── utils │ │ │ ├── MetadataProvider.tsx │ │ │ └── hooks.ts │ ├── tsconfig.json │ └── yarn-error.log ├── gatsby-theme-west-egg-style │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc.js │ ├── README.md │ ├── dist │ │ ├── components │ │ │ ├── Box.d.ts │ │ │ ├── Box.js │ │ │ ├── Box.js.map │ │ │ ├── Button.d.ts │ │ │ ├── Button.js │ │ │ ├── Button.js.map │ │ │ ├── Title.d.ts │ │ │ ├── Title.js │ │ │ └── Title.js.map │ │ └── utils │ │ │ ├── colors.d.ts │ │ │ ├── colors.js │ │ │ ├── colors.js.map │ │ │ ├── hooks.d.ts │ │ │ ├── hooks.js │ │ │ └── hooks.js.map │ ├── gastby-config.js │ ├── gatsby-browser.js │ ├── global.d.ts │ ├── index.js │ ├── package.json │ ├── public │ │ ├── app-95ae1fab5f2ef03e4c7f.js │ │ ├── app-95ae1fab5f2ef03e4c7f.js.map │ │ ├── chunk-map.json │ │ ├── pages-manifest-0d02b77c37c76bc79313.js │ │ ├── pages-manifest-0d02b77c37c76bc79313.js.map │ │ ├── webpack-runtime-4112d92f6d890538b818.js │ │ ├── webpack-runtime-4112d92f6d890538b818.js.map │ │ └── webpack.stats.json │ ├── readmeImages │ │ └── west-egg-style-example.PNG │ ├── src │ │ ├── @types │ │ │ └── gatsby-theme-west-egg-style │ │ │ │ └── index.d.ts │ │ ├── components │ │ │ ├── Box.tsx │ │ │ ├── Button.tsx │ │ │ ├── Container.tsx │ │ │ ├── Content.tsx │ │ │ ├── Footer.tsx │ │ │ ├── Grid.tsx │ │ │ ├── Header.tsx │ │ │ ├── Hero.tsx │ │ │ └── Text.tsx │ │ └── utils │ │ │ ├── colors.ts │ │ │ └── hooks.ts │ └── tsconfig.json └── gatsby-theme-west-egg │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc.js │ ├── README.md │ ├── gatsby-config.js │ ├── gatsby-node.js │ ├── index.js │ ├── package.json │ ├── src │ ├── @types │ │ └── gatsby-theme-west-egg │ │ │ └── index.d.ts │ ├── components │ │ └── posts-page-layout.tsx │ └── pages │ │ ├── blogIndex.tsx │ │ ├── checkout │ │ ├── canceled.tsx │ │ └── success.tsx │ │ └── index.tsx │ └── tsconfig.json ├── site ├── .cache │ ├── .eslintrc.json │ ├── __tests__ │ │ ├── .babelrc │ │ ├── __snapshots__ │ │ │ └── static-entry.js.snap │ │ ├── error-overlay-handler.js │ │ ├── find-page.js │ │ ├── minimal-config.js │ │ ├── static-entry.js │ │ └── strip-prefix.js │ ├── api-runner-browser-plugins.js │ ├── api-runner-browser.js │ ├── api-runner-ssr.js │ ├── api-ssr-docs.js │ ├── app.js │ ├── async-requires.js │ ├── babelState.json │ ├── caches │ │ └── gatsby-mdx │ │ │ ├── diskstore-17ce163646945784868d22fd46a21323.json │ │ │ ├── diskstore-2dcf0ce59c8904d2dcca5b6d13a3553f.json │ │ │ ├── diskstore-3744de239c7de61db4dd4467a065e923.json │ │ │ ├── diskstore-3776883e85636efa8175b0e940125d03.json │ │ │ ├── diskstore-679a3e879c6865977c6c0d1672d16e53.json │ │ │ ├── diskstore-fdb1c3232a1f4f090be307dbd984b504.json │ │ │ └── mdx-scopes-dir │ │ │ └── 1970366a8c100bb8e42caab4bfa24659.js │ ├── commonjs │ │ ├── api-runner-browser-plugins.js │ │ ├── api-runner-browser.js │ │ ├── api-runner-ssr.js │ │ ├── api-ssr-docs.js │ │ ├── app.js │ │ ├── create-react-context.js │ │ ├── default-html.js │ │ ├── develop-static-entry.js │ │ ├── emitter.js │ │ ├── ensure-resources.js │ │ ├── error-overlay-handler.js │ │ ├── find-page.js │ │ ├── gatsby-browser-entry.js │ │ ├── json-store.js │ │ ├── loader.js │ │ ├── navigation.js │ │ ├── page-renderer.js │ │ ├── prefetch.js │ │ ├── production-app.js │ │ ├── public-page-renderer-dev.js │ │ ├── public-page-renderer-prod.js │ │ ├── public-page-renderer.js │ │ ├── react-lifecycles-compat.js │ │ ├── register-service-worker.js │ │ ├── root.js │ │ ├── socketIo.js │ │ ├── static-entry.js │ │ └── strip-prefix.js │ ├── create-react-context.js │ ├── data.json │ ├── default-html.js │ ├── dev-404-page.js │ ├── develop-static-entry.js │ ├── emitter.js │ ├── ensure-resources.js │ ├── error-overlay-handler.js │ ├── find-page.js │ ├── gatsby-browser-entry.js │ ├── json-store.js │ ├── loader.js │ ├── match-paths.json │ ├── navigation.js │ ├── page-renderer.js │ ├── pages.json │ ├── prefetch.js │ ├── production-app.js │ ├── public-page-renderer-dev.js │ ├── public-page-renderer-prod.js │ ├── public-page-renderer.js │ ├── react-lifecycles-compat.js │ ├── redirects.json │ ├── redux.state │ ├── register-service-worker.js │ ├── root.js │ ├── socketIo.js │ ├── static-entry.js │ ├── strip-prefix.js │ ├── sync-requires.js │ └── test-require-error.js ├── .eslintrc.js ├── .prettierrc.js ├── blog │ ├── post1.mdx │ ├── post2.mdx │ ├── post3.mdx │ ├── post4.mdx │ ├── post5.mdx │ └── post6.mdx ├── gatsby-config.js ├── package.json ├── public │ ├── index.html │ └── static │ │ └── d │ │ ├── 51 │ │ └── path---blog-post-5-ebc-968-wZ7vlPNzPF86uJKDhZAVCufUMCw.json │ │ ├── 73 │ │ └── path---blog-index-201-2c5-6xrNRK5rBfqAwq3hMe4DwBluAaU.json │ │ ├── 140 │ │ └── path---index-6a9-0SUcWyAf8ecbYDsMhQkEfPzV8.json │ │ ├── 246 │ │ └── path---checkout-success-57-c-858-0SUcWyAf8ecbYDsMhQkEfPzV8.json │ │ ├── 293 │ │ └── path---blog-post-6-6-dc-86f-m0xl1g5KuUWAsQazaROBdvdB0No.json │ │ ├── 313 │ │ └── path---blog-post-2-803-bf5-oxae3s4XpLTg41lu5UtFD8Q6WU.json │ │ ├── 315 │ │ └── path---checkout-canceled-6-c-7-1d6-0SUcWyAf8ecbYDsMhQkEfPzV8.json │ │ ├── 336 │ │ └── path---blog-post-4-0-fa-b7f-DwwlUSCeX03yIQfCUOtjsx60.json │ │ ├── 870 │ │ └── path---blog-post-1-a-99-95a-s7uSyAfaaIjIFs6jbkFodyeNvW8.json │ │ ├── 893 │ │ └── path---dev-404-page-5-f-9-fab-h5NiDujvwl0d6zFRvrZ9jUfSzc0.json │ │ ├── 902 │ │ └── path---blog-post-3-8-d-2-2d7-Uc6BiNjrHBYaJGWpPsAHh4QZ7c4.json │ │ ├── 2649804226.json │ │ └── 305859193.json ├── tsconfig.json └── yarn-error.log └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .env.* -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gatsby-theme-west-egg 2 | 3 | A Gatsby theme package built with Emotion and Typescript consisting of: 4 | 5 | - [Style theme](https://www.npmjs.com/package/gatsby-theme-west-egg-style) 6 | - Blog theme 7 | - Stripe Cart theme 8 | - Sanity.io studio - WIP 9 | - [Master theme](https://www.npmjs.com/package/gatsby-theme-west-egg) 10 | 11 | View the theme in the wild: [hungrybearstudio.com](https://www.hungrybearstudio.com/) 12 | 13 | Current status: WIP 14 | 15 | ## Built With 16 | 17 | - [Gatsby](https://www.gatsbyjs.org/) 18 | - [Emotion](https://emotion.sh/docs/introduction) 19 | - [Stripe Checkout](https://stripe.com/en-se) 20 | - [TypeScript](https://www.typescriptlang.org/) 21 | 22 | ## Authors 23 | 24 | - **Rich Haines** - _Hungry Bear Studio_ 25 | 26 | ## License 27 | 28 | This project is licensed under the MIT License 29 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsby-theme-west-egg-medley", 3 | "version": "0.0.1", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "private": true, 7 | "keywords": [ 8 | "gatsby", 9 | "gatsby-theme", 10 | "react" 11 | ], 12 | "workspaces": [ 13 | "site", 14 | "packages/*" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-blog/gatsby-config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | { 4 | resolve: 'gatsby-mdx', 5 | options: { 6 | defaultLayouts: { 7 | default: require.resolve('./src/components/posts-page-layout.js') 8 | } 9 | } 10 | }, 11 | { 12 | resolve: 'gatsby-plugin-page-creator', 13 | options: { 14 | path: `${__dirname}/src/pages` 15 | } 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-blog/index.js: -------------------------------------------------------------------------------- 1 | // no-op -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-blog/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsby-theme-west-egg-blog", 3 | "version": "0.0.1", 4 | "description": "A blog theme", 5 | "main": "index.js", 6 | "author": "Hungry Bear Studio ", 7 | "license": "MIT", 8 | "private": false, 9 | "devDependencies": { 10 | "gatsby": "^2.7.1", 11 | "react": "^16.8.6", 12 | "react-dom": "^16.8.6" 13 | }, 14 | "peerDependencies": { 15 | "gatsby": "^2.7.1", 16 | "react": "^16.8.6", 17 | "react-dom": "^16.8.6" 18 | }, 19 | "dependencies": { 20 | "@mdx-js/mdx": "^1.0.0-rc.4", 21 | "@mdx-js/react": "^1.0.0-rc.5", 22 | "gatsby-mdx": "^0.6.3", 23 | "gatsby-plugin-page-creator": "^2.0.13" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-blog/src/components/posts-page-layout.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default ({children}) => ( 4 |
5 | {children} 6 |
7 | ) -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-blog/src/pages/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Default Post in theme 3 | --- 4 | 5 | # The default post in the theme 6 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-core/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | "browser": true, 4 | "es6": true 5 | }, 6 | extends: ["plugin:import/typescript", "prettier/@typescript-eslint", "plugin:prettier/recommended", "prettier", "prettier/react"], 7 | globals: { 8 | Atomics: "readonly", 9 | SharedArrayBuffer: "readonly", 10 | process: true, 11 | logger: true 12 | }, 13 | parser: "@typescript-eslint/parser", 14 | parserOptions: { 15 | ecmaFeatures: { 16 | jsx: true 17 | }, 18 | ecmaVersion: 2018, 19 | sourceType: "module", 20 | project: "./tsconfig.json" 21 | }, 22 | settings: { 23 | react: { 24 | version: "detect" 25 | } 26 | }, 27 | plugins: ["react", "react-hooks", "@typescript-eslint", "prefer-arrow", "promise", "no-null", "import", "prettier"], 28 | rules: { 29 | "prettier/prettier": "error", 30 | "@typescript-eslint/ban-types": [ 31 | "warn", 32 | { 33 | "types": { 34 | "Object": "Use {} instead", 35 | "String": { 36 | "message": "Use string instead", 37 | "fixWith": "string" 38 | } 39 | } 40 | } 41 | ], 42 | "@typescript-eslint/prefer-for-of": "error", 43 | "@typescript-eslint/explicit-member-accessibility": ["error", { "accessibility": "no-public" }], 44 | "@typescript-eslint/no-inferrable-types": ["error", { "ignoreParameters": true, "ignoreProperties": true }], 45 | "no-param-reassign": 0, 46 | "@typescript-eslint/no-var-requires": 0, 47 | "prefer-arrow/prefer-arrow-functions": 0, 48 | "@typescript-eslint/promise-function-async": 0, 49 | "@typescript-eslint/unified-signatures": "error", 50 | "@typescript-eslint/await-thenable": "error", 51 | "no-restricted-imports": "error", 52 | "no-new-wrappers": "error", 53 | "@typescript-eslint/no-for-in-array": "error", 54 | "no-template-curly-in-string": "error", 55 | "@typescript-eslint/no-object-literal-type-assertion": "error", 56 | "no-return-await": "error", 57 | "no-throw-literal": "error", 58 | "@typescript-eslint/no-this-alias": 0, 59 | "@typescript-eslint/no-extraneous-class": "error", 60 | "prefer-object-spread": "error", 61 | "@typescript-eslint/no-require-imports": 0, 62 | "@typescript-eslint/array-type": ["error", "array-simple"], 63 | "@typescript-eslint/prefer-function-type": "error", 64 | "@typescript-eslint/explicit-function-return-type": 0, 65 | "no-undef-init": "error", 66 | "@typescript-eslint/no-unnecessary-qualifier": "warn", 67 | "jsx-alignment": true, 68 | "jsx-boolean-value": [true, "never"], 69 | "jsx-curly-spacing": [true, "never"], 70 | "jsx-equals-spacing": [true, "never"], 71 | "jsx-key": true, 72 | "jsx-no-bind": true, 73 | "jsx-no-lambda": true, 74 | "jsx-no-string-ref": true, 75 | "jsx-self-close": true, 76 | "jsx-space-before-trailing-slash": true, 77 | "jsx-wrap-multiline": [ 78 | true, 79 | { 80 | "declaration": "parens", 81 | "assignment": "parens", 82 | "return": "parens", 83 | "arrow": "parens-new-line", 84 | "condition": "ignore", 85 | "logical": "ignore", 86 | "prop": "ignore" 87 | } 88 | ], 89 | "import/no-cycle": ["error", { "maxDepth": 1 }], 90 | "import/no-self-import": "error", 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-core/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-core/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "printWidth":120, 3 | "tabWidth":2, 4 | "useTabs":true, 5 | "semi":true, 6 | "singleQuote":true, 7 | "trailingComma":"es5", 8 | "bracketSpacing":true, 9 | "jsxBracketSameLine":false, 10 | "arrowParens":"always" 11 | } -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-core/gatsby-config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const pkg = require('./package.json'); 3 | 4 | module.exports = (options) => { 5 | const {title, description, author, twitter, siteUrl} = options; 6 | 7 | return { 8 | siteMetadata: { 9 | title, 10 | description, 11 | author, 12 | siteUrl, 13 | twitter 14 | }, 15 | plugins: [ 16 | 'gatsby-plugin-react-helmet', 17 | 'gatsby-plugin-sharp', 18 | 'gatsby-transformer-sharp', 19 | // { 20 | // resolve: "gatsby-plugin-page-creator", 21 | // options: { 22 | // path: path.join(__dirname, "src", "pages"), 23 | // }, 24 | // }, 25 | // { 26 | // resolve: "gatsby-source-filesystem", 27 | // options: { 28 | // path: path.join(__dirname, "src", "pages"), 29 | // }, 30 | // }, 31 | { 32 | resolve: 'gatsby-plugin-compile-es6-packages', 33 | options: { 34 | modules: [pkg.name] 35 | } 36 | }, 37 | 'gatsby-plugin-sitemap', 38 | 'gatsby-plugin-typescript' 39 | ] 40 | } 41 | } -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-core/gatsby-node.js: -------------------------------------------------------------------------------- 1 | 2 | const fs = require("fs"); 3 | const mkdirp = require("mkdirp"); 4 | const path = require("path"); 5 | 6 | /* Check that the folders used by source-filesystem plugin exist. 7 | * If they do not, they will be created. 8 | */ 9 | 10 | exports.onPreBootstrap = ({ store, reporter }) => { 11 | const { program } = store.getState(); 12 | 13 | const dirs = [ 14 | path.join(program.directory, "blog/"), 15 | ]; 16 | 17 | dirs.forEach(dir => { 18 | if (!fs.existsSync(dir)) { 19 | reporter.log(`creating the ${dir} directory`); 20 | mkdirp.sync(dir); 21 | } 22 | }); 23 | }; -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-core/index.js: -------------------------------------------------------------------------------- 1 | export {default as SEO} from './src/components/SEO'; -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsby-theme-west-egg-core", 3 | "version": "0.0.1", 4 | "description": "Core theme with base content", 5 | "main": "index.js", 6 | "types": "./src/@types/gatsby-theme-west-egg-core/index.d.ts", 7 | "license": "MIT", 8 | "keywords": [ 9 | "gatsby", 10 | "gatsby-theme", 11 | "react" 12 | ], 13 | "scripts": { 14 | "develop": "gatsby develop", 15 | "build": "gatsby build", 16 | "clean": "gatsby clean", 17 | "lint": "./node_modules/.bin/eslint \"src/**/*.{ts,tsx,js}\"", 18 | "eslint-check-rules": "./node_modules/.bin/eslint --print-config . | eslint-config-prettier-check", 19 | "pretty-check": "prettier --check \"src/**/*.{ts,tsx,js}\"", 20 | "pretty": "prettier --write \"src/**/*.{ts,tsx,js}\"", 21 | "sitemap": "gatsby build && gatsby serve" 22 | }, 23 | "husky": { 24 | "hooks": { 25 | "pre-push": "yarn lint && yarn pretty", 26 | "pre-commit": "lint-staged" 27 | } 28 | }, 29 | "lint-staged": { 30 | "src/**/*.{js,ts,tsx}": [ 31 | "yarn pretty-check", 32 | "git add" 33 | ] 34 | }, 35 | "devDependencies": { 36 | "@typescript-eslint/eslint-plugin": "^1.9.0", 37 | "@typescript-eslint/parser": "^1.9.0", 38 | "eslint": "^5.16.0", 39 | "eslint-config-prettier": "^4.3.0", 40 | "eslint-loader": "^2.1.2", 41 | "eslint-plugin-import": "^2.17.2", 42 | "eslint-plugin-no-null": "^1.0.2", 43 | "eslint-plugin-prefer-arrow": "^1.1.5", 44 | "eslint-plugin-prettier": "^3.1.0", 45 | "eslint-plugin-promise": "^4.1.1", 46 | "eslint-plugin-react": "^7.13.0", 47 | "eslint-plugin-react-hooks": "^1.6.0", 48 | "gatsby": "^2.4.2", 49 | "husky": "^2.3.0", 50 | "lint-staged": "^8.1.7", 51 | "prettier": "^1.17.1", 52 | "react": "^16.8.6", 53 | "react-dom": "^16.8.6", 54 | "react-helmet": "^5.2.1", 55 | "typescript": "^3.4.5" 56 | }, 57 | "peerDependencies": { 58 | "gatsby": "^2.4.2", 59 | "react": "^16.8.6", 60 | "react-dom": "^16.8.6" 61 | }, 62 | "dependencies": { 63 | "@types/react": "^16.8.17", 64 | "@types/react-dom": "^16.8.4", 65 | "@types/react-helmet": "^5.0.8", 66 | "gatsby-plugin-compile-es6-packages": "^1.1.0", 67 | "gatsby-plugin-manifest": "^2.1.1", 68 | "gatsby-plugin-offline": "^2.1.1", 69 | "gatsby-plugin-page-creator": "^2.0.13", 70 | "gatsby-plugin-react-helmet": "^3.0.12", 71 | "gatsby-plugin-sharp": "^2.0.37", 72 | "gatsby-plugin-sitemap": "^2.1.0", 73 | "gatsby-plugin-typescript": "^2.0.14", 74 | "gatsby-source-filesystem": "^2.0.37", 75 | "gatsby-transformer-sharp": "^2.1.19", 76 | "mkdirp": "^0.5.1" 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-core/src/@types/gatsby-theme-west-egg-core/index.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'gatsby-theme-west-egg-core' { 2 | /** 3 | * An SEO component which places typical site information in the sites head 4 | */ 5 | export const SEO: () => JSX.Element; 6 | 7 | interface Sitemetadata { 8 | title: string; 9 | description: string; 10 | author: string; 11 | twitter: string; 12 | } 13 | /** 14 | * Hook to provide the site meta data. 15 | * Provides title, description and author 16 | */ 17 | export const useSiteMetadata: () => Sitemetadata; 18 | } 19 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-core/src/components/SEO.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import Helmet from 'react-helmet'; 3 | import { useSiteMetadata } from '../utils/Utilities'; 4 | 5 | /** 6 | * An SEO component which places typical site information in the sites head 7 | */ 8 | export default () => { 9 | const { title, description, twitter } = useSiteMetadata(); 10 | 11 | return ( 12 | 13 | 14 | {title && } 15 | {description && } 16 | 17 | {twitter && } 18 | {title && } 19 | {description && } 20 | 21 | ); 22 | }; 23 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-core/src/utils/Utilities.ts: -------------------------------------------------------------------------------- 1 | import { graphql, useStaticQuery } from 'gatsby'; 2 | 3 | interface Sitemetadata { 4 | title: string; 5 | description: string; 6 | author: string; 7 | twitter: string; 8 | } 9 | 10 | /** 11 | * Hook to provide the site meta data. 12 | * Provides title, description and author 13 | */ 14 | export function useSiteMetadata(): Sitemetadata { 15 | const { site } = useStaticQuery( 16 | graphql` 17 | query SITE_METADATA_QUERY { 18 | site { 19 | siteMetadata { 20 | title 21 | description 22 | author 23 | twitter 24 | } 25 | } 26 | } 27 | ` 28 | ); 29 | return site.siteMetadata; 30 | } 31 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist", 4 | "baseUrl": "./src", 5 | "sourceMap": true, 6 | "noImplicitAny": true, 7 | "noImplicitThis": true, 8 | "strictNullChecks": true, 9 | "importHelpers": true, 10 | "noUnusedLocals": true, 11 | "noUnusedParameters": true, 12 | "module": "esnext", 13 | "moduleResolution": "node", 14 | "target": "es5", 15 | "lib": ["dom", "es5", "es2015", "es2016", "es2018"], 16 | "jsx": "react", 17 | // "allowJs": true, 18 | "alwaysStrict": true, 19 | "forceConsistentCasingInFileNames": true, 20 | "strict": true, 21 | "esModuleInterop": true, 22 | "declaration": true 23 | }, 24 | "include": [ 25 | "./src/**/*" 26 | ], 27 | "exclude": [ 28 | "node_modules", 29 | "dist" 30 | ] 31 | } -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-sanity/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsby-theme-west-egg-sanity", 3 | "version": "0.0.1", 4 | "description": "A sanity theme", 5 | "main": "index.js", 6 | "license": "MIT" 7 | } 8 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-sanity/sanity-studio/README.md: -------------------------------------------------------------------------------- 1 | # Sanity Blogging Content Studio 2 | 3 | Congratulations, you have now installed the Sanity Content Studio, an open source real-time content editing environment connected to the Sanity backend. 4 | 5 | Now you can do the following things: 6 | 7 | - [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme) 8 | - Check out the example frontend: [React/Next.js](https://github.com/sanity-io/tutorial-sanity-blog-react-next) 9 | - [Read the blog post about this template](https://www.sanity.io/blog/build-your-own-blog-with-sanity-and-next-js?utm_source=readme) 10 | - [Join the community Slack](https://slack.sanity.io/?utm_source=readme) 11 | - [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme) 12 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-sanity/sanity-studio/config/.checksums: -------------------------------------------------------------------------------- 1 | { 2 | "#": "Used by Sanity to keep track of configuration file checksums, do not delete or modify!" 3 | } 4 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-sanity/sanity-studio/config/@sanity/data-aspects.json: -------------------------------------------------------------------------------- 1 | { 2 | "listOptions": {} 3 | } 4 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-sanity/sanity-studio/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsbythemewesteggsanity", 3 | "private": true, 4 | "version": "1.0.0", 5 | "description": "", 6 | "main": "package.json", 7 | "author": "Hungry Bear Studio ", 8 | "license": "UNLICENSED", 9 | "scripts": { 10 | "start": "sanity start", 11 | "test": "sanity check" 12 | }, 13 | "keywords": [ 14 | "sanity" 15 | ], 16 | "dependencies": { 17 | "@sanity/base": "^0.140.17", 18 | "@sanity/components": "^0.140.25", 19 | "@sanity/core": "^0.140.25", 20 | "@sanity/default-layout": "^0.140.25", 21 | "@sanity/default-login": "^0.140.15", 22 | "@sanity/desk-tool": "^0.140.25", 23 | "prop-types": "^15.6", 24 | "react": "^16.2", 25 | "react-dom": "^16.2" 26 | }, 27 | "devDependencies": {} 28 | } 29 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-sanity/sanity-studio/plugins/.gitkeep: -------------------------------------------------------------------------------- 1 | User-specific packages can be placed here 2 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-sanity/sanity-studio/sanity.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "project": { 4 | "name": "gatsby-theme-west-egg-sanity" 5 | }, 6 | "api": { 7 | "projectId": "vffw4e9h", 8 | "dataset": "west-egg-blog" 9 | }, 10 | "plugins": [ 11 | "@sanity/base", 12 | "@sanity/components", 13 | "@sanity/default-layout", 14 | "@sanity/default-login", 15 | "@sanity/desk-tool" 16 | ], 17 | "parts": [ 18 | { 19 | "name": "part:@sanity/base/schema", 20 | "path": "./schemas/schema.js" 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-sanity/sanity-studio/schemas/author.js: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'author', 3 | title: 'Author', 4 | type: 'document', 5 | fields: [ 6 | { 7 | name: 'name', 8 | title: 'Name', 9 | type: 'string' 10 | }, 11 | { 12 | name: 'slug', 13 | title: 'Slug', 14 | type: 'slug', 15 | options: { 16 | source: 'name', 17 | maxLength: 96 18 | } 19 | }, 20 | { 21 | name: 'image', 22 | title: 'Image', 23 | type: 'image', 24 | options: { 25 | hotspot: true 26 | } 27 | }, 28 | { 29 | name: 'bio', 30 | title: 'Bio', 31 | type: 'array', 32 | of: [ 33 | { 34 | title: 'Block', 35 | type: 'block', 36 | styles: [{title: 'Normal', value: 'normal'}], 37 | lists: [] 38 | } 39 | ] 40 | } 41 | ], 42 | preview: { 43 | select: { 44 | title: 'name', 45 | media: 'image' 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-sanity/sanity-studio/schemas/blockContent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the schema definition for the rich text fields used for 3 | * for this blog studio. When you import it in schemas.js it can be 4 | * reused in other parts of the studio with: 5 | * { 6 | * name: 'someName', 7 | * title: 'Some title', 8 | * type: 'blockContent' 9 | * } 10 | */ 11 | export default { 12 | title: 'Block Content', 13 | name: 'blockContent', 14 | type: 'array', 15 | of: [ 16 | { 17 | title: 'Block', 18 | type: 'block', 19 | // Styles let you set what your user can mark up blocks with. These 20 | // corrensponds with HTML tags, but you can set any title or value 21 | // you want and decide how you want to deal with it where you want to 22 | // use your content. 23 | styles: [ 24 | {title: 'Normal', value: 'normal'}, 25 | {title: 'H1', value: 'h1'}, 26 | {title: 'H2', value: 'h2'}, 27 | {title: 'H3', value: 'h3'}, 28 | {title: 'H4', value: 'h4'}, 29 | {title: 'Quote', value: 'blockquote'} 30 | ], 31 | lists: [{title: 'Bullet', value: 'bullet'}], 32 | // Marks let you mark up inline text in the block editor. 33 | marks: { 34 | // Decorators usually describe a single property – e.g. a typographic 35 | // preference or highlighting by editors. 36 | decorators: [{title: 'Strong', value: 'strong'}, {title: 'Emphasis', value: 'em'}], 37 | // Annotations can be any object structure – e.g. a link or a footnote. 38 | annotations: [ 39 | { 40 | title: 'URL', 41 | name: 'link', 42 | type: 'object', 43 | fields: [ 44 | { 45 | title: 'URL', 46 | name: 'href', 47 | type: 'url' 48 | } 49 | ] 50 | } 51 | ] 52 | } 53 | }, 54 | // You can add additional types here. Note that you can't use 55 | // primitive types such as 'string' and 'number' in the same array 56 | // as a block type. 57 | { 58 | type: 'image', 59 | options: {hotspot: true} 60 | } 61 | ] 62 | } 63 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-sanity/sanity-studio/schemas/category.js: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'category', 3 | title: 'Category', 4 | type: 'document', 5 | fields: [ 6 | { 7 | name: 'title', 8 | title: 'Title', 9 | type: 'string' 10 | }, 11 | { 12 | name: 'description', 13 | title: 'Description', 14 | type: 'text' 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-sanity/sanity-studio/schemas/post.js: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'post', 3 | title: 'Post', 4 | type: 'document', 5 | fields: [ 6 | { 7 | name: 'title', 8 | title: 'Title', 9 | type: 'string' 10 | }, 11 | { 12 | name: 'slug', 13 | title: 'Slug', 14 | type: 'slug', 15 | options: { 16 | source: 'title', 17 | maxLength: 96 18 | } 19 | }, 20 | { 21 | name: 'author', 22 | title: 'Author', 23 | type: 'reference', 24 | to: {type: 'author'} 25 | }, 26 | { 27 | name: 'mainImage', 28 | title: 'Main image', 29 | type: 'image', 30 | options: { 31 | hotspot: true 32 | } 33 | }, 34 | { 35 | name: 'categories', 36 | title: 'Categories', 37 | type: 'array', 38 | of: [{type: 'reference', to: {type: 'category'}}] 39 | }, 40 | { 41 | name: 'publishedAt', 42 | title: 'Published at', 43 | type: 'datetime' 44 | }, 45 | { 46 | name: 'body', 47 | title: 'Body', 48 | type: 'blockContent' 49 | } 50 | ], 51 | 52 | preview: { 53 | select: { 54 | title: 'title', 55 | author: 'author.name', 56 | media: 'mainImage' 57 | }, 58 | prepare(selection) { 59 | const {author} = selection 60 | return Object.assign({}, selection, { 61 | subtitle: author && `by ${author}` 62 | }) 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-sanity/sanity-studio/schemas/schema.js: -------------------------------------------------------------------------------- 1 | // First, we must import the schema creator 2 | import createSchema from 'part:@sanity/base/schema-creator' 3 | 4 | // Then import schema types from any plugins that might expose them 5 | import schemaTypes from 'all:part:@sanity/base/schema-type' 6 | 7 | // We import object and document schemas 8 | import blockContent from './blockContent' 9 | import category from './category' 10 | import post from './post' 11 | import author from './author' 12 | 13 | // Then we give our schema to the builder and provide the result to Sanity 14 | export default createSchema({ 15 | // We name our schema 16 | name: 'default', 17 | // Then proceed to concatenate our our document type 18 | // to the ones provided by any plugins that are installed 19 | types: schemaTypes.concat([ 20 | // The following are document types which will appear 21 | // in the studio. 22 | post, 23 | author, 24 | category, 25 | // When added to this list, object types can be used as 26 | // { type: 'typename' } in other document schemas 27 | blockContent 28 | ]) 29 | }) 30 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-sanity/sanity-studio/static/.gitkeep: -------------------------------------------------------------------------------- 1 | Files placed here will be served by the Sanity server under the `/static`-prefix 2 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-sanity/sanity-studio/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molebox/gatsby-theme-west-egg/966bc835d4f961e3b7db78b664c28407daabd19b/packages/gatsby-theme-west-egg-sanity/sanity-studio/static/favicon.ico -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-stripe-cart/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | "browser": true, 4 | "es6": true 5 | }, 6 | extends: ["plugin:import/typescript", "prettier/@typescript-eslint", "plugin:prettier/recommended", "prettier", "prettier/react"], 7 | globals: { 8 | Atomics: "readonly", 9 | SharedArrayBuffer: "readonly", 10 | process: true, 11 | logger: true 12 | }, 13 | parser: "@typescript-eslint/parser", 14 | parserOptions: { 15 | ecmaFeatures: { 16 | jsx: true 17 | }, 18 | ecmaVersion: 2018, 19 | sourceType: "module", 20 | project: "./tsconfig.json" 21 | }, 22 | settings: { 23 | react: { 24 | version: "detect" 25 | } 26 | }, 27 | plugins: ["react", "react-hooks", "@typescript-eslint", "prefer-arrow", "promise", "no-null", "import", "prettier"], 28 | rules: { 29 | "prettier/prettier": "error", 30 | "@typescript-eslint/ban-types": [ 31 | "warn", 32 | { 33 | "types": { 34 | "Object": "Use {} instead", 35 | "String": { 36 | "message": "Use string instead", 37 | "fixWith": "string" 38 | } 39 | } 40 | } 41 | ], 42 | "@typescript-eslint/prefer-for-of": "error", 43 | "@typescript-eslint/explicit-member-accessibility": ["error", { "accessibility": "no-public" }], 44 | "@typescript-eslint/no-inferrable-types": ["error", { "ignoreParameters": true, "ignoreProperties": true }], 45 | "no-param-reassign": 0, 46 | "@typescript-eslint/no-var-requires": 0, 47 | "prefer-arrow/prefer-arrow-functions": 0, 48 | "@typescript-eslint/promise-function-async": 0, 49 | "@typescript-eslint/unified-signatures": "error", 50 | "@typescript-eslint/await-thenable": "error", 51 | "no-restricted-imports": "error", 52 | "no-new-wrappers": "error", 53 | "@typescript-eslint/no-for-in-array": "error", 54 | "no-template-curly-in-string": "error", 55 | "@typescript-eslint/no-object-literal-type-assertion": "error", 56 | "no-return-await": "error", 57 | "no-throw-literal": "error", 58 | "@typescript-eslint/no-this-alias": 0, 59 | "@typescript-eslint/no-extraneous-class": "error", 60 | "prefer-object-spread": "error", 61 | "@typescript-eslint/no-require-imports": 0, 62 | "@typescript-eslint/array-type": ["error", "array-simple"], 63 | "@typescript-eslint/prefer-function-type": "error", 64 | "@typescript-eslint/explicit-function-return-type": 0, 65 | "no-undef-init": "error", 66 | "@typescript-eslint/no-unnecessary-qualifier": "warn", 67 | "jsx-alignment": true, 68 | "jsx-boolean-value": [true, "never"], 69 | "jsx-curly-spacing": [true, "never"], 70 | "jsx-equals-spacing": [true, "never"], 71 | "jsx-key": true, 72 | "jsx-no-bind": true, 73 | "jsx-no-lambda": true, 74 | "jsx-no-string-ref": true, 75 | "jsx-self-close": true, 76 | "jsx-space-before-trailing-slash": true, 77 | "jsx-wrap-multiline": [ 78 | true, 79 | { 80 | "declaration": "parens", 81 | "assignment": "parens", 82 | "return": "parens", 83 | "arrow": "parens-new-line", 84 | "condition": "ignore", 85 | "logical": "ignore", 86 | "prop": "ignore" 87 | } 88 | ], 89 | "import/no-cycle": ["error", { "maxDepth": 1 }], 90 | "import/no-self-import": "error", 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-stripe-cart/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .env.* 3 | dist -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-stripe-cart/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "printWidth":120, 3 | "tabWidth":2, 4 | "useTabs":true, 5 | "semi":true, 6 | "singleQuote":true, 7 | "trailingComma":"es5", 8 | "bracketSpacing":true, 9 | "jsxBracketSameLine":false, 10 | "arrowParens":"always" 11 | } -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-stripe-cart/README.md: -------------------------------------------------------------------------------- 1 | # gatsby-theme-west-egg-stripe-cart 2 | 3 | A Gatsby theme for a stripe checkout. Register an account at [Stripe](https://stripe.com/en-se) 4 | 5 | Add to your Gatsby sites gatsby-config.js just like you would with a plugin. The `STRIPE_API_KEY`, `STRIPE_SECRET_KEY` and `siteUrl` are passed in as options from the consuming theme. 6 | 7 | ``` 8 | module.exports = { 9 | 10 | __experimentalThemes: [ 11 | 'gatsby-theme-west-egg-style', 12 | { 13 | resolve: 'gatsby-theme-west-egg-stripe-cart', 14 | options: { 15 | STRIPE_API_KEY, 16 | STRIPE_SECRET_KEY, 17 | siteUrl 18 | } 19 | } 20 | ], 21 | } 22 | ``` 23 | 24 | Example usage: 25 | 26 | ``` 27 | import { StripeCheckout } from 'gatsby-theme-west-egg-stripe-cart'; 28 | 29 | } 31 | sku='sku_123' 32 | quantity={1} 33 | /> 34 | ``` 35 | 36 | The component takes a custom button as its form submit which enables you to style it which ever way you wish, it only requires that you provide its type as 'submit'. 37 | 38 | In addition the component requires you to provide the products sku (which can be taken from your products in your stripe dashboard) and the quantity of items to purchase. 39 | 40 | Once the user clicks the button to make a purchase they are redirected to the stripe checkout where they can fill out their card details and complete their purchase. Upon completion the user is redirected back to your gatsby site. 41 | 42 | This theme provides two base components (success/canceled) which you should shadow and style yourself. These components should be placed in a checkout folder inside your src/pages folder: 43 | 44 | ``` 45 | src/pages/checkout/success 46 | src/pages/checkout/canceled 47 | ``` 48 | 49 | Current status: WIP 50 | 51 | ## Built With 52 | 53 | - [Gatbsy](https://www.gatsbyjs.org/) 54 | - [Stripe](https://stripe.com/en-se) 55 | - [TypeScript](https://www.typescriptlang.org/) 56 | 57 | ## Authors 58 | 59 | - **Rich Haines** - _Hungry Bear Studio_ 60 | 61 | ## License 62 | 63 | This project is licensed under the MIT License 64 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-stripe-cart/gatsby-config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const pkg = require('./package.json'); 3 | 4 | module.exports = (options) => { 5 | const {STRIPE_API_KEY, STRIPE_SECRET_KEY, siteUrl} = options; 6 | 7 | return { 8 | siteMetadata: { 9 | STRIPE_API_KEY, 10 | siteUrl 11 | }, 12 | plugins: [ 13 | 'gatsby-plugin-stripe', 14 | { 15 | resolve: `gatsby-source-stripe`, 16 | options: { 17 | objects: ['Sku'], 18 | secretKey: STRIPE_SECRET_KEY, 19 | downloadFiles: true, 20 | auth: false, 21 | } 22 | }, 23 | { 24 | resolve: `gatsby-source-filesystem`, 25 | options: { 26 | name: `images`, 27 | path: `${__dirname}/src/images/`, 28 | }, 29 | }, 30 | { 31 | resolve: "gatsby-plugin-page-creator", 32 | options: { 33 | path: path.join(__dirname, "src", "pages"), 34 | }, 35 | }, 36 | { 37 | resolve: `gatsby-source-filesystem`, 38 | options: { 39 | name: `pages`, 40 | path: `${__dirname}/src/pages/`, 41 | }, 42 | }, 43 | { 44 | resolve: 'gatsby-plugin-compile-es6-packages', 45 | options: { 46 | modules: [pkg.name] 47 | } 48 | } 49 | ] 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-stripe-cart/index.js: -------------------------------------------------------------------------------- 1 | // exported components that can be edited by the consuming site 2 | export {default as StripeCheckout} from './src/components/StripeCheckout'; -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-stripe-cart/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsby-theme-west-egg-stripe-cart", 3 | "version": "0.0.1", 4 | "description": "A base shopping cart theme", 5 | "main": "./src/index.js", 6 | "types": "./src/@types/gatsby-theme-west-egg-stripe-cart/index.d.ts", 7 | "license": "MIT", 8 | "keywords": [ 9 | "gatsby", 10 | "gatsby-theme", 11 | "react", 12 | "cart", 13 | "ecommerce" 14 | ], 15 | "scripts": { 16 | "develop": "gatsby develop", 17 | "build": "gatsby build", 18 | "clean": "gatsby clean", 19 | "lint": "./node_modules/.bin/eslint \"src/**/*.{ts,tsx,js}\"", 20 | "eslint-check-rules": "./node_modules/.bin/eslint --print-config . | eslint-config-prettier-check", 21 | "pretty-check": "prettier --check \"src/**/*.{ts,tsx,js}\"", 22 | "pretty": "prettier --write \"src/**/*.{ts,tsx,js}\"" 23 | }, 24 | "husky": { 25 | "hooks": { 26 | "pre-push": "yarn lint && yarn pretty", 27 | "pre-commit": "lint-staged" 28 | } 29 | }, 30 | "lint-staged": { 31 | "src/**/*.{js,ts,tsx}": [ 32 | "yarn pretty-check", 33 | "git add" 34 | ] 35 | }, 36 | "devDependencies": { 37 | "@types/react": "^16.8.17", 38 | "@types/react-dom": "^16.8.4", 39 | "@types/stripe-checkout": "^1.0.3", 40 | "@typescript-eslint/eslint-plugin": "^1.8.0", 41 | "@typescript-eslint/parser": "^1.8.0", 42 | "eslint": "^5.16.0", 43 | "eslint-config-prettier": "^4.2.0", 44 | "eslint-loader": "^2.1.2", 45 | "eslint-plugin-import": "^2.17.2", 46 | "eslint-plugin-no-null": "^1.0.2", 47 | "eslint-plugin-prefer-arrow": "^1.1.5", 48 | "eslint-plugin-prettier": "^3.0.1", 49 | "eslint-plugin-promise": "^4.1.1", 50 | "eslint-plugin-react": "^7.13.0", 51 | "eslint-plugin-react-hooks": "^1.6.0", 52 | "gatsby": "^2.4.2", 53 | "husky": "^2.2.0", 54 | "lint-staged": "^8.1.6", 55 | "prettier": "^1.17.0", 56 | "react": "^16.8.6", 57 | "react-dom": "^16.8.6", 58 | "typescript": "^3.4.5" 59 | }, 60 | "peerDependencies": { 61 | "gatsby": "^2.4.2", 62 | "react": "^16.8.6", 63 | "react-dom": "^16.8.6" 64 | }, 65 | "dependencies": { 66 | "gatsby-plugin-compile-es6-packages": "^1.1.0", 67 | "gatsby-plugin-page-creator": "^2.0.12", 68 | "gatsby-plugin-stripe": "^1.2.0", 69 | "gatsby-source-filesystem": "^2.0.36", 70 | "gatsby-source-stripe": "^2.2.2" 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-stripe-cart/src/@types/gatsby-theme-west-egg-stripe-cart/index.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'gatsby-theme-west-egg-stripe-cart' { 2 | 3 | interface Stripe { 4 | button: JSX.Element; 5 | sku: string; 6 | quantity: number; 7 | } 8 | 9 | /** 10 | * A Stripe checkout form. When submitted the user will be redirected to the stripe checkout. 11 | * Upon completion of purchase the user will be redirected back to your website. 12 | * 13 | * @example } sku="sku_123" quantity={1}/> 14 | * @param button A custom button element to submit the form 15 | * @param sku A product stock keeping unit 16 | * @param quantity The quantity to be included in the checkout 17 | */ 18 | export const StripeCheckout: (props: Stripe) => JSX.Element; 19 | } -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-stripe-cart/src/components/StripeCheckout.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import {MetadataContext, MetadataProvider} from '../utils/MetadataProvider'; 3 | 4 | interface Stripe { 5 | button: JSX.Element; 6 | sku: string; 7 | quantity: number; 8 | } 9 | 10 | const StripeButton = ({ button, sku, quantity }: Stripe) => { 11 | const metadata = React.useContext(MetadataContext); 12 | 13 | if (!metadata) { 14 | return

make an error component to handle this stuff

; 15 | } 16 | 17 | let stripe: any; 18 | const { STRIPE_API_KEY, siteUrl } = metadata; 19 | 20 | React.useEffect(() => { 21 | stripe = Stripe(STRIPE_API_KEY); 22 | }, []); 23 | 24 | return ( 25 |
{ 27 | e.preventDefault(); 28 | stripe && 29 | stripe 30 | .redirectToCheckout({ 31 | items: [{ sku, quantity }], 32 | 33 | // Note that it is not guaranteed your customers will be redirected to this 34 | // URL *100%* of the time, it's possible that they could e.g. close the 35 | // tab between form submission and the redirect. 36 | successUrl: `${siteUrl}/checkout/success`, 37 | cancelUrl: `${siteUrl}/checkout/canceled`, 38 | }) 39 | .then((result: any) => { 40 | console.log({ result }); 41 | if (result.error) { 42 | console.log(result.error.message); 43 | // If `redirectToCheckout` fails due to a browser or network 44 | // error, handle the error -- toast ? 45 | } 46 | }); 47 | }} 48 | > 49 | {button} 50 |
51 | ); 52 | }; 53 | 54 | /** 55 | * A Stripe checkout form. When submitted the user will be redirected to the stripe checkout. 56 | * Upon completion of purchase the user will be redirected back to your website. 57 | * 58 | * @example } sku="sku_123" quantity={1}/> 59 | * @param button A custom button element to submit the form 60 | * @param sku A product stock keeping unit 61 | * @param quantity The quantity to be included in the checkout 62 | */ 63 | export default ({ button, sku, quantity }: Stripe) => ( 64 | 65 | 70 | 71 | ) -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-stripe-cart/src/pages/checkout/canceled.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | export default () => ( 4 |
11 |

Purchase Canceled!

12 |
override me as im not pretty...
13 |
to do that you have to shadow me in your site, or theme.
14 |
15 | ); 16 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-stripe-cart/src/pages/checkout/success.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | export default () => ( 4 |
11 |

Success!

12 |
override me as im not pretty...
13 |
to do that you have to shadow me in your site, or theme.
14 |
15 | ); 16 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-stripe-cart/src/utils/MetadataProvider.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { useSiteMetadata } from './hooks'; 3 | 4 | type Metadata = { 5 | STRIPE_API_KEY: string; 6 | siteUrl: string; 7 | } 8 | 9 | export const MetadataContext = React.createContext(undefined); 10 | 11 | export const MetadataProvider = ({children}: any) => { 12 | const { STRIPE_API_KEY, siteUrl } = useSiteMetadata(); 13 | return ( 14 | 15 | {children} 16 | 17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-stripe-cart/src/utils/hooks.ts: -------------------------------------------------------------------------------- 1 | import { graphql, useStaticQuery } from 'gatsby'; 2 | 3 | /** 4 | * Hook to provide the site meta data. 5 | * Provides STRIPE_API_KEY and siteUrl 6 | */ 7 | export const useSiteMetadata = () => { 8 | const { site } = useStaticQuery( 9 | graphql` 10 | query { 11 | site { 12 | siteMetadata { 13 | STRIPE_API_KEY 14 | siteUrl 15 | } 16 | } 17 | } 18 | ` 19 | ); 20 | return site.siteMetadata; 21 | }; 22 | 23 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-stripe-cart/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist", 4 | "baseUrl": "./src", 5 | "sourceMap": true, 6 | "noImplicitAny": true, 7 | "noImplicitThis": true, 8 | "strictNullChecks": true, 9 | "importHelpers": true, 10 | "noUnusedLocals": true, 11 | "noUnusedParameters": true, 12 | "module": "esnext", 13 | "moduleResolution": "node", 14 | "target": "es5", 15 | "lib": ["dom", "es5", "es2015", "es2016", "es2018"], 16 | "jsx": "react", 17 | // "allowJs": true, 18 | "alwaysStrict": true, 19 | "forceConsistentCasingInFileNames": true, 20 | "strict": true, 21 | "esModuleInterop": true, 22 | "declaration": true 23 | }, 24 | "include": [ 25 | "./src/**/*" 26 | ], 27 | "exclude": [ 28 | "node_modules", 29 | "dist", 30 | "./src/pages" 31 | ] 32 | } -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-style/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | "browser": true, 4 | "es6": true 5 | }, 6 | extends: ["plugin:import/typescript", "prettier/@typescript-eslint", "plugin:prettier/recommended", "prettier", "prettier/react"], 7 | globals: { 8 | Atomics: "readonly", 9 | SharedArrayBuffer: "readonly", 10 | process: true, 11 | logger: true 12 | }, 13 | parser: "@typescript-eslint/parser", 14 | parserOptions: { 15 | ecmaFeatures: { 16 | jsx: true 17 | }, 18 | ecmaVersion: 2018, 19 | sourceType: "module", 20 | project: "./tsconfig.json" 21 | }, 22 | settings: { 23 | react: { 24 | version: "detect" 25 | } 26 | }, 27 | plugins: ["react", "react-hooks", "@typescript-eslint", "prefer-arrow", "promise", "no-null", "import", "prettier"], 28 | rules: { 29 | "prettier/prettier": "error", 30 | "@typescript-eslint/ban-types": [ 31 | "warn", 32 | { 33 | "types": { 34 | "Object": "Use {} instead", 35 | "String": { 36 | "message": "Use string instead", 37 | "fixWith": "string" 38 | } 39 | } 40 | } 41 | ], 42 | "@typescript-eslint/prefer-for-of": "error", 43 | "@typescript-eslint/explicit-member-accessibility": ["error", { "accessibility": "no-public" }], 44 | "@typescript-eslint/no-inferrable-types": ["error", { "ignoreParameters": true, "ignoreProperties": true }], 45 | "no-param-reassign": 0, 46 | "@typescript-eslint/no-var-requires": 0, 47 | "prefer-arrow/prefer-arrow-functions": 0, 48 | "@typescript-eslint/promise-function-async": 0, 49 | "@typescript-eslint/unified-signatures": "error", 50 | "@typescript-eslint/await-thenable": "error", 51 | "no-restricted-imports": "error", 52 | "no-new-wrappers": "error", 53 | "@typescript-eslint/no-for-in-array": "error", 54 | "no-template-curly-in-string": "error", 55 | "@typescript-eslint/no-object-literal-type-assertion": "error", 56 | "no-return-await": "error", 57 | "no-throw-literal": "error", 58 | "@typescript-eslint/no-this-alias": 0, 59 | "@typescript-eslint/no-extraneous-class": "error", 60 | "prefer-object-spread": "error", 61 | "@typescript-eslint/no-require-imports": 0, 62 | "@typescript-eslint/array-type": ["error", "array-simple"], 63 | "@typescript-eslint/prefer-function-type": "error", 64 | "@typescript-eslint/explicit-function-return-type": 0, 65 | "no-undef-init": "error", 66 | "@typescript-eslint/no-unnecessary-qualifier": "warn", 67 | "jsx-alignment": true, 68 | "jsx-boolean-value": [true, "never"], 69 | "jsx-curly-spacing": [true, "never"], 70 | "jsx-equals-spacing": [true, "never"], 71 | "jsx-key": true, 72 | "jsx-no-bind": true, 73 | "jsx-no-lambda": true, 74 | "jsx-no-string-ref": true, 75 | "jsx-self-close": true, 76 | "jsx-space-before-trailing-slash": true, 77 | "jsx-wrap-multiline": [ 78 | true, 79 | { 80 | "declaration": "parens", 81 | "assignment": "parens", 82 | "return": "parens", 83 | "arrow": "parens-new-line", 84 | "condition": "ignore", 85 | "logical": "ignore", 86 | "prop": "ignore" 87 | } 88 | ], 89 | "import/no-cycle": ["error", { "maxDepth": 1 }], 90 | "import/no-self-import": "error", 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-style/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | readmeImages/ 4 | .cache/ 5 | public -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-style/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "printWidth":120, 3 | "tabWidth":2, 4 | "useTabs":true, 5 | "semi":true, 6 | "singleQuote":true, 7 | "trailingComma":"es5", 8 | "bracketSpacing":true, 9 | "jsxBracketSameLine":false, 10 | "arrowParens":"always" 11 | } -------------------------------------------------------------------------------- /packages/gatsby-theme-west-egg-style/README.md: -------------------------------------------------------------------------------- 1 | # gatsby-theme-west-egg-style 2 | 3 | A Gatsby theme that provides a set of styled components. 4 | 5 | Add to your Gatsby sites gatsby-config.js just like you would with a plugin. 6 | 7 | ``` 8 | module.exports = { 9 | 10 | __experimentalThemes: ['gatsby-theme-west-egg-style'] 11 | } 12 | ``` 13 | 14 | Example usage: 15 | 16 | ``` 17 | import React from 'react'; 18 | import {Box, Title, Button, Grid, Container, Header, Hero, Content, Footer} from 'gatsby-theme-west-egg-style'; 19 | import colors from 'gatsby-theme-west-egg-style/src/utils/colors'; 20 | 21 | const boxes = [ 22 | 23 | Box 1 24 | , 25 | 26 | Box 2 27 | , 28 |