├── .nvmrc ├── projects ├── .gitkeep ├── caldera-www │ ├── gatsby-browser.js │ ├── gatsby-node.js │ ├── src │ │ ├── style │ │ │ ├── index.js │ │ │ ├── utils.js │ │ │ └── theme.js │ │ ├── favicon.png │ │ ├── assets │ │ │ ├── images │ │ │ │ └── its-a-date-logo.png │ │ │ ├── svgs │ │ │ │ ├── arrow-right.svg │ │ │ │ ├── blue-blob3.svg │ │ │ │ ├── guess-the-throne │ │ │ │ │ ├── dark-blue-blob1.svg │ │ │ │ │ ├── dark-blue-blob3.svg │ │ │ │ │ ├── dark-blue-blob4.svg │ │ │ │ │ └── dark-blue-blob2.svg │ │ │ │ ├── caldera-logo.svg │ │ │ │ ├── gamebyrd │ │ │ │ │ ├── red-blob3.svg │ │ │ │ │ ├── red-blob1.svg │ │ │ │ │ └── red-blob2.svg │ │ │ │ ├── pride-of-the-meadows │ │ │ │ │ ├── green-blob4.svg │ │ │ │ │ ├── green-blob3.svg │ │ │ │ │ ├── green-blob1.svg │ │ │ │ │ └── green-blob2.svg │ │ │ │ ├── its-a-date │ │ │ │ │ ├── teal-blob3.svg │ │ │ │ │ ├── teal-blob1.svg │ │ │ │ │ └── teal-blob2.svg │ │ │ │ ├── blue-blob2.svg │ │ │ │ ├── blue-blob5.svg │ │ │ │ ├── web.svg │ │ │ │ └── analytics.svg │ │ │ └── rawSvgs │ │ │ │ └── clients │ │ │ │ └── cam-logo.svg │ │ ├── components │ │ │ ├── index.js │ │ │ ├── Homepage │ │ │ │ ├── CallToAction.js │ │ │ │ ├── Welcome.js │ │ │ │ ├── WhoWeveWorkedWith.js │ │ │ │ └── OurServices.js │ │ │ ├── Blob.js │ │ │ ├── Layout.js │ │ │ ├── Button.js │ │ │ ├── NavBar.js │ │ │ ├── Seo.js │ │ │ ├── ImageLinkSection.js │ │ │ └── Form.js │ │ ├── utils │ │ │ ├── utilityService.js │ │ │ └── formUtils.js │ │ ├── pages │ │ │ ├── 404.js │ │ │ ├── thank-you.js │ │ │ ├── index.js │ │ │ └── contact-us.js │ │ └── html.js │ ├── static │ │ ├── robots.txt │ │ └── _redirects │ ├── .eslintrc.js │ ├── LICENSE │ ├── package.json │ └── gatsby-config.js ├── ecommerce-stripe-client │ ├── public │ │ ├── _redirects │ │ ├── robots.txt │ │ ├── favicon.ico │ │ ├── logo192.png │ │ ├── logo512.png │ │ ├── manifest.json │ │ └── index.html │ ├── src │ │ ├── react-app-env.d.ts │ │ ├── utils │ │ │ ├── const.ts │ │ │ ├── theme.ts │ │ │ └── utilityService.ts │ │ ├── components │ │ │ ├── index.ts │ │ │ ├── error.tsx │ │ │ ├── loading.tsx │ │ │ ├── pageWrapper.tsx │ │ │ ├── scrollToTop.tsx │ │ │ ├── productList.tsx │ │ │ ├── privateRoute.tsx │ │ │ └── navBar.tsx │ │ ├── pages │ │ │ ├── NoMatch │ │ │ │ └── NoMatch.tsx │ │ │ ├── LoginPage │ │ │ │ └── LoginPage.tsx │ │ │ ├── CartPage │ │ │ │ ├── CartPage.tsx │ │ │ │ └── CheckoutForm.tsx │ │ │ ├── ThankYou │ │ │ │ └── ThankYou.tsx │ │ │ └── HomePage │ │ │ │ └── HomePage.tsx │ │ ├── caldera-platform.d.ts │ │ ├── config │ │ │ └── firebase.ts │ │ ├── context │ │ │ └── AuthContext.tsx │ │ ├── types │ │ │ └── index.ts │ │ ├── App.tsx │ │ ├── index.tsx │ │ ├── hooks │ │ │ └── useAuth.ts │ │ └── serviceWorker.ts │ ├── config-overrides.js │ ├── tsconfig.json │ ├── .eslintrc.js │ ├── package.json │ ├── README.md │ └── CHANGELOG.md ├── ecommerce-stripe-shared │ ├── src │ │ ├── fixtures │ │ │ ├── index.js │ │ │ └── games │ │ │ │ └── index.js │ │ ├── index.js │ │ └── const.js │ ├── rollup.config.js │ ├── package.json │ └── CHANGELOG.md └── ecommerce-stripe-server │ ├── firestore.indexes.json │ ├── src │ ├── index.ts │ ├── utils │ │ └── store.ts │ ├── onCreateUser.ts │ └── stripeCharge.ts │ ├── .firebaserc │ ├── .gitignore │ ├── firebase.json │ ├── tsconfig.json │ ├── firestore.rules │ ├── package.json │ ├── init-db.js │ └── CHANGELOG.md ├── static └── .gitkeep ├── .npmrc ├── packages ├── core │ ├── src │ │ ├── index.js │ │ └── Loading.js │ ├── rollup.config.js │ ├── CHANGELOG.md │ └── package.json ├── nav │ ├── src │ │ ├── index.js │ │ ├── Nav.fixture.js │ │ ├── Hamburger.js │ │ └── Nav.js │ ├── rollup.config.js │ └── package.json ├── theme │ ├── src │ │ ├── index.js │ │ ├── Container.js │ │ ├── media.js │ │ ├── theme.js │ │ └── GlobalStyle.js │ ├── rollup.config.js │ ├── package.json │ └── CHANGELOG.md ├── rollup-config │ ├── babel.config.js │ ├── package.json │ ├── src │ │ └── index.js │ └── CHANGELOG.md └── babel-preset │ ├── package.json │ ├── CHANGELOG.md │ └── src │ └── index.js ├── cosmos.config.json ├── .prettierrc ├── babel.config.js ├── cosmos └── globalStyle.css ├── .editorconfig ├── .travis.yml ├── lerna.json ├── .vscode ├── ecommerce-stripe.code-workspace ├── caldera-platform.code-workspace └── settings.json ├── commitlint.config.js ├── .eslintrc ├── LICENSE ├── .gitignore └── README.md /.nvmrc: -------------------------------------------------------------------------------- 1 | lts/dubnium -------------------------------------------------------------------------------- /projects/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /projects/caldera-www/gatsby-browser.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /projects/caldera-www/gatsby-node.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | scripts-prepend-node-path=true 2 | -------------------------------------------------------------------------------- /packages/core/src/index.js: -------------------------------------------------------------------------------- 1 | export * from './Loading' 2 | -------------------------------------------------------------------------------- /projects/caldera-www/src/style/index.js: -------------------------------------------------------------------------------- 1 | export * from './theme' 2 | -------------------------------------------------------------------------------- /projects/caldera-www/static/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Allow: / 3 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/public/_redirects: -------------------------------------------------------------------------------- 1 | /* /index.html 200 2 | -------------------------------------------------------------------------------- /packages/nav/src/index.js: -------------------------------------------------------------------------------- 1 | export * from './Nav' 2 | export * from './Hamburger' 3 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-shared/src/fixtures/index.js: -------------------------------------------------------------------------------- 1 | export * from './games' 2 | -------------------------------------------------------------------------------- /projects/caldera-www/.eslintrc.js: -------------------------------------------------------------------------------- 1 | // Empty because gatsby's linter lints monorepo bundles 🙃 2 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-shared/src/index.js: -------------------------------------------------------------------------------- 1 | export * from './fixtures' 2 | export * from './const' 3 | -------------------------------------------------------------------------------- /cosmos.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "globalImports": ["./cosmos/globalStyle.css"], 3 | "staticPath": "static" 4 | } 5 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-shared/src/fixtures/games/index.js: -------------------------------------------------------------------------------- 1 | export { default as GAMES } from './games.json' 2 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-server/firestore.indexes.json: -------------------------------------------------------------------------------- 1 | { 2 | "indexes": [], 3 | "fieldOverrides": [] 4 | } 5 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-server/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './onCreateUser' 2 | export * from './stripeCharge' 3 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all", 4 | "semi": false, 5 | "eslintIntegration": true 6 | } 7 | -------------------------------------------------------------------------------- /projects/caldera-www/src/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/caldera-digital/platform/HEAD/projects/caldera-www/src/favicon.png -------------------------------------------------------------------------------- /projects/ecommerce-stripe-server/.firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "default": "ecommerce-stripe-example" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/utils/const.ts: -------------------------------------------------------------------------------- 1 | // Make sure to update in /public as well 2 | export const APP_NAME = 'Gamebyrd' 3 | -------------------------------------------------------------------------------- /packages/theme/src/index.js: -------------------------------------------------------------------------------- 1 | export * from './media' 2 | export * from './GlobalStyle' 3 | export * from './Container' 4 | export * from './theme' 5 | -------------------------------------------------------------------------------- /packages/nav/rollup.config.js: -------------------------------------------------------------------------------- 1 | import config from '@caldera-digital/rollup-config' 2 | import pkg from './package.json' 3 | 4 | export default config(pkg) 5 | -------------------------------------------------------------------------------- /packages/rollup-config/babel.config.js: -------------------------------------------------------------------------------- 1 | const config = require('@caldera-digital/babel-preset') 2 | 3 | module.exports = config({ modules: 'commonjs' }) 4 | -------------------------------------------------------------------------------- /packages/core/rollup.config.js: -------------------------------------------------------------------------------- 1 | import config from '@caldera-digital/rollup-config' 2 | import pkg from './package.json' 3 | 4 | export default config(pkg) 5 | -------------------------------------------------------------------------------- /packages/theme/rollup.config.js: -------------------------------------------------------------------------------- 1 | import config from '@caldera-digital/rollup-config' 2 | import pkg from './package.json' 3 | 4 | export default config(pkg) 5 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/caldera-digital/platform/HEAD/projects/ecommerce-stripe-client/public/favicon.ico -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/caldera-digital/platform/HEAD/projects/ecommerce-stripe-client/public/logo192.png -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/caldera-digital/platform/HEAD/projects/ecommerce-stripe-client/public/logo512.png -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['@caldera-digital/babel-preset'], 3 | ignore: ['**/dist'], 4 | babelrcRoots: ['.', 'packages/**', 'projects.**'], 5 | } 6 | -------------------------------------------------------------------------------- /projects/caldera-www/src/assets/images/its-a-date-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/caldera-digital/platform/HEAD/projects/caldera-www/src/assets/images/its-a-date-logo.png -------------------------------------------------------------------------------- /projects/ecommerce-stripe-shared/rollup.config.js: -------------------------------------------------------------------------------- 1 | import config from '@caldera-digital/rollup-config' 2 | import pkg from './package.json' 3 | 4 | export default config(pkg) 5 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-server/.gitignore: -------------------------------------------------------------------------------- 1 | ## Compiled JavaScript files 2 | lib/**/*.js 3 | lib/**/*.js.map 4 | 5 | # Typescript v1 declaration files 6 | typings/ 7 | 8 | lib/ 9 | -------------------------------------------------------------------------------- /cosmos/globalStyle.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: sans-serif; 3 | margin: 0; 4 | padding: 0; 5 | } 6 | 7 | *, 8 | *::before, 9 | *::after { 10 | box-sizing: border-box; 11 | } 12 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | end_of_line = lf 10 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/components/index.ts: -------------------------------------------------------------------------------- 1 | export * from './error' 2 | export * from './loading' 3 | export * from './privateRoute' 4 | export * from './scrollToTop' 5 | export * from './navBar' 6 | export * from './pageWrapper' 7 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/pages/NoMatch/NoMatch.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import { PageWrapper } from '../../components' 4 | 5 | export const NoMatchPage = () => { 6 | return Not found. 7 | } 8 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-server/src/utils/store.ts: -------------------------------------------------------------------------------- 1 | import * as admin from 'firebase-admin' 2 | import { config } from 'firebase-functions' 3 | 4 | admin.initializeApp(config().firebase) 5 | 6 | export const db = admin.firestore() 7 | export const auth = admin.auth() 8 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/components/error.tsx: -------------------------------------------------------------------------------- 1 | import React, { FC } from 'react' 2 | 3 | export const Error: FC<{ error?: any }> = ({ children, error }) => { 4 | if (error) console.error(error) 5 | 6 | return

{children || 'Something went wrong.'}

7 | } 8 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-server/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "firestore": { 3 | "rules": "firestore.rules", 4 | "indexes": "firestore.indexes.json" 5 | }, 6 | "functions": { 7 | "predeploy": "npm --prefix \"$RESOURCE_DIR\" run build", 8 | "source": "/" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/caldera-platform.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Declared here because platform is not fully converted to typescript yet. 3 | */ 4 | 5 | declare module '@caldera-digital/ecommerce-stripe-shared' 6 | declare module '@caldera-digital/nav' 7 | declare module '@caldera-digital/theme' 8 | -------------------------------------------------------------------------------- /projects/caldera-www/src/style/utils.js: -------------------------------------------------------------------------------- 1 | import { keyframes } from 'styled-components' 2 | 3 | export const jiggle = keyframes` 4 | 0% { 5 | transform: scale(1); 6 | } 7 | 50% { 8 | transform: scale(1.1) translate(30px, 20px) rotate(10deg); 9 | } 10 | 100% { 11 | transform: scale(1); 12 | } 13 | ` 14 | -------------------------------------------------------------------------------- /projects/caldera-www/src/components/index.js: -------------------------------------------------------------------------------- 1 | export * from './NavBar' 2 | export * from './Layout' 3 | export * from './Seo' 4 | export * from './Button' 5 | export * from './Section' 6 | export * from './Footer' 7 | export * from './Hero' 8 | export * from './Form' 9 | export * from './ImageLinkSection' 10 | export * from './GroovyPhone' 11 | -------------------------------------------------------------------------------- /projects/caldera-www/src/utils/utilityService.js: -------------------------------------------------------------------------------- 1 | export const createOptimizedCloudinary = (url = '', params = '') => { 2 | // eslint-disable-next-line no-unused-vars 3 | const [_, id] = url.split('image/upload/') 4 | 5 | return `https://res.cloudinary.com/calderablog/image/upload/f_auto,fl_progressive,c_crop,q_auto:good,${params}/${id}` 6 | } 7 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": true, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true 11 | }, 12 | "compileOnSave": true, 13 | "include": ["src"] 14 | } 15 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/components/loading.tsx: -------------------------------------------------------------------------------- 1 | import { Spin } from 'antd' 2 | import React, { FC } from 'react' 3 | import styled from 'styled-components' 4 | 5 | const StyledLoader = styled(Spin)` 6 | position: absolute !important; 7 | top: 50%; 8 | left: 50%; 9 | transform: translate(-50%, -50%); 10 | ` 11 | 12 | export const Loading: FC = () => { 13 | return 14 | } 15 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | if: type = pull_request 2 | 3 | language: node_js 4 | 5 | git: 6 | depth: 3 7 | 8 | node_js: 9 | - '10.15.0' 10 | 11 | before_install: 12 | - curl -o- -L https://yarnpkg.com/install.sh | bash 13 | - export PATH="$HOME/.yarn/bin:$PATH" 14 | 15 | install: 16 | - yarn global add lerna jest 17 | - yarn bootstrap 18 | 19 | script: 20 | - yarn lint 21 | - yarn build 22 | - yarn test 23 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/utils/theme.ts: -------------------------------------------------------------------------------- 1 | import { DEFAULT_THEME } from '@caldera-digital/theme' 2 | 3 | /** 4 | * Extend the theme here like so... 5 | * 6 | * { 7 | * ...DEFAULT_THEME, 8 | * primaryColor: 'burlywood', 9 | * } 10 | */ 11 | export const THEME = { 12 | primaryColor: '#32325D', // Stripe primary 13 | secondaryColor: '#3ecf8e', // Stripe CTA color from website 14 | ...DEFAULT_THEME, 15 | } 16 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-shared/src/const.js: -------------------------------------------------------------------------------- 1 | export const FIREBASE_CONFIG = { 2 | apiKey: 'AIzaSyDmFQQS4KgiCGsNiXumO3JpcRgwe-8OiWA', 3 | authDomain: 'ecommerce-stripe-example.firebaseapp.com', 4 | databaseURL: 'https://ecommerce-stripe-example.firebaseio.com', 5 | projectId: 'ecommerce-stripe-example', 6 | storageBucket: '', 7 | messagingSenderId: '598364109281', 8 | appId: '1:598364109281:web:e67274c78fee5e29', 9 | } 10 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/utils/utilityService.ts: -------------------------------------------------------------------------------- 1 | import { omit } from 'lodash/fp' 2 | 3 | import { Product, ProductShort } from '../types' 4 | 5 | export const createShortProduct = ( 6 | product: Product | ProductShort, 7 | ): ProductShort => 8 | // @ts-ignore 9 | omit(['quantity', 'quantity_sold', 'received_by'])(product) 10 | 11 | export const getPurchaseByFirebaseID = (purchases: [any], id: string) => 12 | purchases.find(purchase => purchase.id === id) 13 | -------------------------------------------------------------------------------- /projects/caldera-www/src/pages/404.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { Layout, SEO } from '../components' 3 | 4 | class NotFoundPage extends React.Component { 5 | render() { 6 | return ( 7 | 8 | 9 |

Not Found

10 |

You just hit a route that doesn't exist... the sadness.

11 |
12 | ) 13 | } 14 | } 15 | 16 | export default NotFoundPage 17 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/config/firebase.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * If you have multiple environments, you'd bootstrap them here. One way to do is add REACT_APP_ENV=prod to 3 | * an NPM script and check it here. 4 | */ 5 | import 'firebase/auth' 6 | import 'firebase/firestore' 7 | 8 | import { FIREBASE_CONFIG } from '@caldera-digital/ecommerce-stripe-shared' 9 | import firebase from 'firebase/app' 10 | 11 | const config = FIREBASE_CONFIG 12 | 13 | firebase.initializeApp(config) 14 | export default firebase 15 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/config-overrides.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-var-requires */ 2 | /* eslint-disable import/no-commonjs */ 3 | const { override, fixBabelImports, addLessLoader } = require('customize-cra') 4 | 5 | module.exports = override( 6 | fixBabelImports('import', { 7 | libraryName: 'antd', 8 | libraryDirectory: 'es', 9 | style: true, 10 | }), 11 | addLessLoader({ 12 | javascriptEnabled: true, 13 | modifyVars: { '@primary-color': '#32325D' }, 14 | }), 15 | ) 16 | -------------------------------------------------------------------------------- /packages/core/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | ## 1.0.1 (2019-08-29) 8 | 9 | 10 | ### :sparkles: Features 11 | 12 | * home page and mobile tweaks ([b5b820e](https://github.com/caldera-digital/platform/commit/b5b820e)) 13 | * nav, start on hero, core module, config updates ([617202b](https://github.com/caldera-digital/platform/commit/617202b)) 14 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/context/AuthContext.tsx: -------------------------------------------------------------------------------- 1 | import React, { FC } from 'react' 2 | 3 | import { AuthState, defaultAuthState, useAuth } from '../hooks/useAuth' 4 | 5 | export const AuthContext = React.createContext(defaultAuthState) 6 | 7 | export const AuthProvider: FC = ({ children }) => { 8 | const authState = useAuth() 9 | 10 | return ( 11 | {children} 12 | ) 13 | } 14 | 15 | export const AuthConsumer = AuthContext.Consumer 16 | -------------------------------------------------------------------------------- /projects/caldera-www/src/pages/thank-you.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { Layout, SEO } from '../components' 3 | import { ContactThankYouContainer } from './contact-us' 4 | 5 | const ThankYou = ({ location }) => { 6 | return ( 7 | 8 | 9 | 10 |

Thank You

11 |

Someone from our team will be in touch soon.

12 |
13 |
14 | ) 15 | } 16 | 17 | export default ThankYou 18 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/components/pageWrapper.tsx: -------------------------------------------------------------------------------- 1 | import { Container } from '@caldera-digital/theme' 2 | import React, { FC } from 'react' 3 | 4 | import { NavBar } from './navBar' 5 | 6 | type P = { 7 | showNav?: boolean 8 | fluid?: false 9 | } 10 | 11 | export const PageWrapper: FC

= ({ 12 | children, 13 | showNav = true, 14 | fluid = false, 15 | }) => { 16 | return ( 17 |

18 | {showNav && } 19 | 20 | 21 | {children} 22 | 23 |
24 | ) 25 | } 26 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-server/firestore.rules: -------------------------------------------------------------------------------- 1 | rules_version = '2'; 2 | service cloud.firestore { 3 | match /databases/{database}/documents { 4 | match /users/{user} { 5 | // Could be written into a common function 6 | allow read, write: if request.auth != null && user == request.auth.uid 7 | 8 | match /payments/{paymentId} { 9 | allow read, write: if request.auth != null && user == request.auth.uid 10 | } 11 | } 12 | match /products/{product} { 13 | allow read: if request.auth != null 14 | allow write: if false 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /projects/caldera-www/src/components/Homepage/CallToAction.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | import { Section } from '../Section' 4 | import { LinkButton } from '../Button' 5 | 6 | const CallToActionButton = styled(LinkButton)` 7 | text-align: center; 8 | margin: 0 auto; 9 | ` 10 | 11 | export const CallToAction = () => { 12 | return ( 13 |
17 | Contact Us 18 |
19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/components/scrollToTop.tsx: -------------------------------------------------------------------------------- 1 | import React, { FC, PropsWithChildren, useEffect } from 'react' 2 | import { RouteComponentProps, withRouter } from 'react-router-dom' 3 | 4 | type P = PropsWithChildren 5 | 6 | const ScrollToTopComponent: FC

= ({ 7 | children = null, 8 | location: { pathname }, 9 | }: P) => { 10 | useEffect(() => { 11 | window.scrollTo(0, 0) 12 | }, [pathname]) 13 | 14 | // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33006 15 | return <>{children} 16 | } 17 | 18 | export const ScrollToTop = withRouter(ScrollToTopComponent) 19 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "noEmit": true, 20 | "jsx": "react" 21 | }, 22 | "include": [ 23 | "src" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /projects/caldera-www/src/utils/formUtils.js: -------------------------------------------------------------------------------- 1 | export const emailIsValid = email => { 2 | return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) 3 | } 4 | 5 | export const encode = data => { 6 | return Object.keys(data) 7 | .map(key => encodeURIComponent(key) + '=' + encodeURIComponent(data[key])) 8 | .join('&') 9 | } 10 | 11 | export const isEmpty = obj => { 12 | for (const prop in obj) { 13 | if (obj.hasOwnProperty(prop)) return false 14 | } 15 | 16 | return true 17 | } 18 | 19 | export const isFunction = functionToCheck => { 20 | return ( 21 | functionToCheck && {}.toString.call(functionToCheck) === '[object Function]' 22 | ) 23 | } 24 | -------------------------------------------------------------------------------- /packages/theme/src/Container.js: -------------------------------------------------------------------------------- 1 | import styled, { css } from 'styled-components' 2 | 3 | export const Container = styled.div` 4 | width: 100%; 5 | margin-right: auto; 6 | margin-left: auto; 7 | 8 | ${({ fluid }) => 9 | !fluid && 10 | css` 11 | padding-right: 15px; 12 | padding-left: 15px; 13 | 14 | @media (min-width: 576px) { 15 | max-width: 540px; 16 | } 17 | 18 | @media (min-width: 768px) { 19 | max-width: 720px; 20 | } 21 | 22 | @media (min-width: 992px) { 23 | max-width: 960px; 24 | } 25 | 26 | @media (min-width: 1200px) { 27 | max-width: ${props => props.theme.maxContainerWidth}; 28 | } 29 | `} 30 | ` 31 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "independent", 3 | "npmClient": "yarn", 4 | "useWorkspaces": true, 5 | "command": { 6 | "version": { 7 | "message": "chore(release): publish", 8 | "conventionalCommits": true, 9 | "noCommitHooks": true, 10 | "changelogPreset": "conventional-changelog-angular-emoji", 11 | "allowBranch": "master" 12 | }, 13 | "publish": { 14 | "yes": true, 15 | "conventionalCommits": true, 16 | "noCommitHooks": true, 17 | "changelogPreset": "conventional-changelog-angular-emoji", 18 | "allowBranch": "master" 19 | } 20 | }, 21 | "ignoreChanges": [ 22 | "**/__fixtures__/**", 23 | "**/__tests__/**", 24 | "**/__mocks__/**", 25 | "**/*fixture.js", 26 | "**/*.md" 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /.vscode/ecommerce-stripe.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "../" 5 | } 6 | ], 7 | "settings": { 8 | "workbench.colorCustomizations": { 9 | "titleBar.activeBackground": "#32325D", 10 | "titleBar.activeForeground": "#ffffff", 11 | "titleBar.inactiveBackground": "#32325D", 12 | "titleBar.inactiveForeground": "#ffffff" 13 | }, 14 | "search.exclude": { 15 | "**/node_modules": true, 16 | "**/projects/*/dist": true, 17 | "**/packages/*/dist": true, 18 | "**/projects/*/build": true, 19 | "**/packages/*/build": true, 20 | "**/projects/*/coverage": true, 21 | "**/packages/*/coverage": true 22 | }, 23 | "files.exclude": { 24 | "**/projects/caldera*": true 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.vscode/caldera-platform.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "../" 5 | } 6 | ], 7 | "settings": { 8 | "workbench.colorCustomizations": { 9 | "titleBar.activeBackground": "#0080ee", 10 | "titleBar.activeForeground": "#ffffff", 11 | "titleBar.inactiveBackground": "#0080ee", 12 | "titleBar.inactiveForeground": "#ffffff" 13 | }, 14 | "search.exclude": { 15 | "**/node_modules": true, 16 | "**/build": true, 17 | "**/projects/*/dist": true, 18 | "**/packages/*/dist": true, 19 | "**/projects/*/build": true, 20 | "**/packages/*/build": true, 21 | "**/projects/*/coverage": true, 22 | "**/packages/*/coverage": true 23 | }, 24 | "files.exclude": { 25 | "**/projects/ecommerce-stripe*": true, 26 | "**/build": true 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/theme/src/media.js: -------------------------------------------------------------------------------- 1 | import { css } from 'styled-components' 2 | 3 | const sizes = { 4 | forSmallOnly: { 5 | max: true, 6 | width: 680, 7 | }, 8 | forSmallMediumOnly: { 9 | max: true, 10 | width: 991, 11 | }, 12 | forMediumUp: { 13 | max: false, 14 | width: 681, 15 | }, 16 | forLargeUp: { 17 | max: false, 18 | width: 992, 19 | }, 20 | } 21 | 22 | // Iterate through the sizes and create a media template 23 | export const media = Object.keys(sizes).reduce((acc, label) => { 24 | acc[label] = (...args) => { 25 | if (sizes[label].max) { 26 | return css` 27 | @media (max-width: ${sizes[label].width / 16}em) { 28 | ${css(...args)}; 29 | } 30 | ` 31 | } 32 | return css` 33 | @media (min-width: ${sizes[label].width / 16}em) { 34 | ${css(...args)}; 35 | } 36 | ` 37 | } 38 | 39 | return acc 40 | }, {}) 41 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/types/index.ts: -------------------------------------------------------------------------------- 1 | export type Product = { 2 | id: string 3 | title: string 4 | rating: number 5 | console: string 6 | cover: string 7 | cover_alt: string 8 | quantity: number 9 | quantity_sold: number 10 | price: number 11 | description: string 12 | received_by: string 13 | comments: string 14 | } 15 | 16 | export type ProductShort = { 17 | id: string 18 | title: string 19 | rating: number 20 | console: string 21 | cover: string 22 | cover_alt: string 23 | price: number 24 | description: string 25 | comments: string 26 | } 27 | 28 | export type User = { 29 | cart: ProductShort[] 30 | purchases: any 31 | userId: string 32 | joined: string 33 | email: string 34 | displayName: string 35 | firstName: string 36 | lastName: string 37 | photoURL: string 38 | phoneNumber: string 39 | stripeCharges: any[] 40 | stripeCustomerID: string 41 | } 42 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | rules: { 3 | // 'body-leading-blank': [1, 'always'], 4 | // 'footer-leading-blank': [1, 'always'], 5 | // 'header-max-length': [2, 'always', 72], 6 | // 'scope-case': [2, 'always', 'lower-case'], 7 | // 'subject-case': [ 8 | // 2, 9 | // 'never', 10 | // ['sentence-case', 'start-case', 'pascal-case', 'upper-case'], 11 | // ], 12 | // 'subject-empty': [2, 'never'], 13 | // 'subject-full-stop': [2, 'never', '.'], 14 | // 'type-case': [2, 'always', 'lower-case'], 15 | // 'type-empty': [2, 'never'], 16 | 'type-enum': [ 17 | 2, 18 | 'always', 19 | [ 20 | 'build', 21 | 'chore', 22 | 'ci', 23 | 'docs', 24 | 'feat', 25 | 'fix', 26 | 'perf', 27 | 'refactor', 28 | 'revert', 29 | 'style', 30 | 'test', 31 | ], 32 | ], 33 | }, 34 | } 35 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "arrow-body-style": ["off"], 4 | "comma-dangle": ["off"], 5 | "class-methods-use-this": ["off"], 6 | "no-invalid-this": ["off"], 7 | "import/no-named-as-default": ["off"], 8 | "quotes": [2, "single"], 9 | "no-console": ["off"], 10 | "import/no-nodejs-modules": ["off"], 11 | "import/prefer-default-export": ["off"], 12 | "import/no-namespace": ["off"], 13 | "import/noextraneous-dependencies": ["off"], 14 | "no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], 15 | "no-sync": ["off", { "allowRootLevel": true }], 16 | "jest/no-disabled-tests": ["off"] 17 | }, 18 | "extends": [ 19 | "node", 20 | "react-app", 21 | "plugin:import/errors", 22 | "plugin:import/warnings", 23 | "plugin:prettier/recommended", 24 | "plugin:jest/recommended" 25 | ], 26 | "plugins": ["jest", "import"], 27 | "globals": { 28 | "jest": true 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true, 3 | "editor.codeActionsOnSaveTimeout": 4000, 4 | "cSpell.words": [ 5 | "BITBUCKET", 6 | "Netlify", 7 | "Workspaces", 8 | "accu", 9 | "antd", 10 | "authed", 11 | "brainhubeu", 12 | "browserslist", 13 | "cloudinary", 14 | "disqus", 15 | "dribbble", 16 | "dubnium", 17 | "duplicative", 18 | "ecommerce", 19 | "editorconfig", 20 | "firebaseui", 21 | "fiverr", 22 | "formik", 23 | "lerna", 24 | "linkedin", 25 | "merp", 26 | "narative", 27 | "nohoist", 28 | "noopener", 29 | "noreferrer", 30 | "novela", 31 | "onstatechange", 32 | "onupdatefound", 33 | "potm", 34 | "prettierrc", 35 | "prismjs", 36 | "repo", 37 | "roboto", 38 | "signin", 39 | "smedium", 40 | "spammy", 41 | "svgr", 42 | "svgs", 43 | "unmount", 44 | "weve" 45 | ], 46 | "cSpell.allowCompoundWords": true 47 | } 48 | -------------------------------------------------------------------------------- /projects/caldera-www/src/style/theme.js: -------------------------------------------------------------------------------- 1 | export const theme = { 2 | maxContainerWidth: '1080px', 3 | darkGray: '#4d4d4d', 4 | defaultFont: '"Roboto", sans-serif', 5 | defaultHeaderFont: '"Palanquin", sans-serif', 6 | defaultFontColor: '#383735', 7 | defaultFontSize: '16px', 8 | defaultParagraphLineHeight: '1.5', 9 | defaultHeaderColor: '#000000', 10 | defaultInputBackgroundColor: '#f5f5f5', 11 | defaultMobileFontSize: '16px', 12 | defaultTransition: 'all 0.2s linear', 13 | desktopHeaderHeight: '75px', 14 | disabledColor: '#888888', 15 | errorColor: '#e44100', 16 | focusColor: '#0080EE', 17 | grayText: '#707070', 18 | lightGray: '#B3B3B3', 19 | linkColor: '#0080EE', 20 | mobileHeaderHeight: '60px', 21 | primaryColor: '#0080EE', 22 | secondaryColor: '#f57e58', 23 | hoveredSecondaryColor: '#fc9a7c', 24 | pressedSecondaryColor: '#fc9a7c', 25 | lightBackgroundColor: '#EDF6FE', 26 | borderBlurColor: '#CFE7EE', 27 | white: '#ffffff', 28 | bodyBackgroundColor: '#ffffff !important', 29 | } 30 | -------------------------------------------------------------------------------- /projects/caldera-www/src/assets/svgs/arrow-right.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-shared/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@caldera-digital/ecommerce-stripe-shared", 3 | "version": "0.2.4", 4 | "description": "Shared code between server and client", 5 | "homepage": "https://github.com/caldera-digital/platform#readme", 6 | "bugs": { 7 | "url": "https://github.com/caldera-digital/platform/issues" 8 | }, 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/caldera-digital/platform.git" 15 | }, 16 | "main": "dist/index.js", 17 | "module": "dist/index.module.js", 18 | "scripts": { 19 | "build": "rollup -c rollup.config.js", 20 | "clean": "run-p clean:*", 21 | "clean:build": "rimraf dist", 22 | "clean:node_modules": "rimraf node_modules", 23 | "dev": "rollup -c rollup.config.js -w", 24 | "lint": "eslint src/**/*.js", 25 | "lint:fix": "eslint src/**/*.js --fix", 26 | "test": "echo 'No tests, coming soon!'" 27 | }, 28 | "devDependencies": { 29 | "@caldera-digital/rollup-config": "^1.0.3" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/pages/LoginPage/LoginPage.tsx: -------------------------------------------------------------------------------- 1 | import * as firebaseui from 'firebaseui' 2 | import React from 'react' 3 | import StyledFirebaseAuth from 'react-firebaseui/StyledFirebaseAuth' 4 | 5 | import { PageWrapper } from '../../components' 6 | import firebase from '../../config/firebase' 7 | import { APP_NAME } from '../../utils/const' 8 | 9 | // Configure FirebaseUI. 10 | const uiConfig = { 11 | // Popup signin flow rather than redirect flow. 12 | signInFlow: 'popup', 13 | // Redirect to /signedIn after sign in is successful. Alternatively you can provide a callbacks.signInSuccess function. 14 | signInSuccessUrl: '/', 15 | credentialHelper: firebaseui.auth.CredentialHelper.NONE, 16 | signInOptions: [firebase.auth.EmailAuthProvider.PROVIDER_ID], 17 | } 18 | 19 | export const LoginPage: React.FC = () => { 20 | return ( 21 | 22 |

{APP_NAME}

23 | 24 | 25 | ) 26 | } 27 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@caldera-digital/ecommerce-stripe-server", 3 | "version": "0.2.4", 4 | "scripts": { 5 | "clean": "run-p clean:*", 6 | "clean:build": "rimraf dist", 7 | "clean:node_modules": "rimraf node_modules", 8 | "lint": "eslint src/**/*.{ts,tsx,js}", 9 | "lint:fix": "eslint src/**/*.{ts,tsx,js} --fix", 10 | "build": "tsc", 11 | "dev": "npm run build && firebase serve --only functions", 12 | "shell": "npm run build && firebase functions:shell", 13 | "start": "npm run shell", 14 | "deploy": "firebase deploy", 15 | "logs": "firebase functions:log", 16 | "test": "echo 'No tests, coming soon!'", 17 | "init-db": "node ./init-db.js" 18 | }, 19 | "publishConfig": { 20 | "access": "public" 21 | }, 22 | "engines": { 23 | "node": "10" 24 | }, 25 | "main": "lib/index.js", 26 | "dependencies": { 27 | "@caldera-digital/ecommerce-stripe-shared": "^0.2.4", 28 | "firebase-admin": "^8.4.0", 29 | "firebase-functions": "^3.2.0", 30 | "lodash": "^4.17.15", 31 | "stripe": "^7.8.0" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/App.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { BrowserRouter as Router, Route, Switch } from 'react-router-dom' 3 | 4 | import { PrivateRoute, ScrollToTop } from './components' 5 | import { CartPage } from './pages/CartPage/CartPage' 6 | import { HomePage } from './pages/HomePage/HomePage' 7 | import { LoginPage } from './pages/LoginPage/LoginPage' 8 | import { NoMatchPage } from './pages/NoMatch/NoMatch' 9 | import { ThankYouPage } from './pages/ThankYou/ThankYou' 10 | 11 | const App: React.FC = () => { 12 | return ( 13 | 14 | 15 | 16 | 17 | 18 | 19 | 24 | 25 | 26 | 27 | 28 | ) 29 | } 30 | 31 | export default App 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Marcus Wood 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /projects/caldera-www/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Gatsbyjs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/index.tsx: -------------------------------------------------------------------------------- 1 | // Replace this line with polyfills import for browser support 2 | import 'normalize.css' 3 | 4 | import { GlobalStyle } from '@caldera-digital/theme' 5 | import React from 'react' 6 | import ReactDOM from 'react-dom' 7 | import { StripeProvider } from 'react-stripe-elements' 8 | import { ThemeProvider } from 'styled-components' 9 | 10 | import App from './App' 11 | import { AuthProvider } from './context/AuthContext' 12 | import * as serviceWorker from './serviceWorker' 13 | import { THEME } from './utils/theme' 14 | 15 | ReactDOM.render( 16 | 17 | {/* This is the test apiKey! */} 18 | 19 | 20 | <> 21 | 22 | 23 | 24 | 25 | 26 | , 27 | document.getElementById('root'), 28 | ) 29 | 30 | // If you want your app to work offline and load faster, you can change 31 | // unregister() to register() below. Note this comes with some pitfalls. 32 | // Learn more about service workers: https://bit.ly/CRA-PWA 33 | serviceWorker.unregister() 34 | -------------------------------------------------------------------------------- /packages/core/src/Loading.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | const LoadingContainer = styled.div` 5 | position: absolute; 6 | left: 50%; 7 | top: 50%; 8 | transform: translate(-50%, -50%); 9 | ` 10 | 11 | const StyledLoading = styled.div` 12 | height: 0; 13 | width: 0; 14 | padding: ${({ size }) => { 15 | if (size === 'large') { 16 | return '9px' 17 | } else if (size === 'medium') { 18 | return '6px' 19 | } 20 | return '3px' 21 | }}; 22 | border: ${({ size }) => { 23 | let borderSize 24 | if (size === 'large') { 25 | borderSize = '6px' 26 | } else if (size === 'medium') { 27 | borderSize = '5px' 28 | } else { 29 | borderSize = '4px' 30 | } 31 | 32 | return `${borderSize} solid #ccc` 33 | }}; 34 | border-right-color: #888; 35 | border-radius: 50%; 36 | animation: rotate 1s infinite linear; 37 | 38 | @keyframes rotate { 39 | /* 100% keyframe for clockwise. 40 | use 0% instead for anticlockwise */ 41 | 100% { 42 | transform: rotate(360deg); 43 | } 44 | } 45 | ` 46 | 47 | export const Loading = ({ size = 'small' }) => ( 48 | 49 | 50 | 51 | ) 52 | -------------------------------------------------------------------------------- /projects/ecommerce-stripe-client/src/hooks/useAuth.ts: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from 'react' 2 | 3 | import firebase from '../config/firebase' 4 | 5 | const db = firebase.firestore() 6 | 7 | export interface AuthState { 8 | isAuthed: boolean 9 | loading: boolean 10 | user?: firebase.User 11 | logout?: () => void 12 | } 13 | 14 | export const defaultAuthState: AuthState = { 15 | isAuthed: false, 16 | loading: true, 17 | } 18 | 19 | export const useAuth = (): AuthState => { 20 | const [authState, setAuthState] = useState(defaultAuthState) 21 | 22 | useEffect( 23 | () => 24 | firebase.auth().onAuthStateChanged(user => { 25 | if (user) { 26 | setAuthState({ isAuthed: true, user, loading: false }) 27 | } else { 28 | setAuthState({ isAuthed: false, loading: false, user: undefined }) 29 | } 30 | }), 31 | [], 32 | ) 33 | 34 | /** 35 | * Why no setState here? Because the above effect subscription will fire and take care of everything for us. 36 | * Redirects will automatically be handle via PrivateRoute so that users aren't always redirected in case they're 37 | * on a public page. 38 | */ 39 | const logout = (): Promise => firebase.auth().signOut() 40 | 41 | return { ...authState, logout } 42 | } 43 | -------------------------------------------------------------------------------- /packages/nav/src/Nav.fixture.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { Nav } from './Nav' 3 | import { 4 | CalderaDigitalThemeProvider, 5 | CalderaDigitalThemeConsumer, 6 | } from '@caldera-digital/theme' 7 | import { ThemeProvider } from 'styled-components' 8 | 9 | export default ( 10 | 11 | 12 | {theme => ( 13 | 14 |