Skip to content

Instantly share code, notes, and snippets.

View ryanbelke's full-sized avatar
💭
coding

Ryan Beke ryanbelke

💭
coding
  • Austin, Tx
View GitHub Profile
@ryanbelke
ryanbelke / checkout.js
Last active October 21, 2018 00:39
checkout.js
/* pages/checkout.js */
import React, { Component } from "react";
import defaultPage from "../hocs/defaultPage";
import Cart from "../components/Cart/Cart";
import InjectedCheckoutForm from "../components/Checkout/CheckoutForm";
import { Row, Col } from "reactstrap";
import { StripeProvider, Elements } from "react-stripe-elements";
import { withContext } from "../components/Context/AppProvider";
/* /components/Checkout/CheckoutForm.js */
import React from "react";
import CardSection from "./CardSection";
import { FormGroup, Label, Input, FormText, Row, Col } from "reactstrap";
import { injectStripe } from "react-stripe-elements";
import Strapi from "strapi-sdk-javascript/build/main";
import Router from "next/router";
/* components/Checkout/cardsection.js */
import React from "react";
import { CardElement, CardNumberElement } from "react-stripe-elements";
import { injectStripe } from "react-stripe-elements";
class CardSection extends React.Component {
render() {
return (
/* /pages/index.js */
import RestaurantList from "../components/RestaurantList";
import React from "react";
import {
Alert,
Button,
Col,
Input,
@ryanbelke
ryanbelke / _app.js
Last active October 20, 2018 22:02
new _app.js with Apollo
/* /pages/_app.js */
import Layout from "../components/Layout";
import withData from "../lib/apollo";
import App, { Container } from "next/app";
import React from "react";
class MyApp extends App {
static async getInitialProps({ Component, router, ctx }) {
@ryanbelke
ryanbelke / restaurants.js
Created October 13, 2018 03:45
restaurants.js file before Cart/Context and Authentication
/* /pages/restaurants.js */
import gql from "graphql-tag";
import { withRouter } from "next/router";
import { graphql } from "react-apollo";
import { compose } from "recompose";
import {
Button,
Card,
CardBody,
@ryanbelke
ryanbelke / Layout.js
Last active October 20, 2018 22:38
Layout.js with auth component
/* /components/Layout.js */
import React from "react";
import Head from "next/head";
import Link from "next/link";
import { unsetToken } from "../lib/auth";
import { Container, Nav, NavItem } from "reactstrap";
import defaultPage from "../hocs/defaultPage";
import Cookie from "js-cookie";
@ryanbelke
ryanbelke / _app.js
Created October 13, 2018 18:17
_app.js updated with React Context
/* /pages/_app.js */
import Layout from "../components/Layout";
import withData from "../lib/apollo";
import AppProvider from "../components/Context/AppProvider";
import defaultPage from "../hocs/defaultPage";
import { compose } from "recompose";
import App, { Container } from "next/app";
import React from "react";
@ryanbelke
ryanbelke / restaurants.js
Created October 13, 2018 18:19
restaurants.js file updated for provider component
/* /pages/restaurants.js */
import gql from "graphql-tag";
import { withRouter } from "next/router";
import { graphql } from "react-apollo";
import { compose } from "recompose";
import { withContext } from "../components/Context/AppProvider";
import {
Button,
Card,
@ryanbelke
ryanbelke / order.js
Created October 13, 2018 18:37
strapi server order.js file
"use strict";
/**
* Order.js controller
*
* @description: A set of functions called "actions" for managing `Order`.
*/
const stripe = require("stripe")("sk_test_INSERT YOUR API KEY");