Skip to content

Instantly share code, notes, and snippets.

View AlbionaHoti's full-sized avatar
💎

albicodes AlbionaHoti

💎
View GitHub Profile

Keybase proof

I hereby claim:

  • I am albionahoti on github.
  • I am hoti5 (https://keybase.io/hoti5) on keybase.
  • I have a public key ASDAS744Bw6WJc4SwzRdgtY6kEEAagIkWvRuBO1kPcZqzQo

To claim this, I am signing this object:

@AlbionaHoti
AlbionaHoti / Layout2.js
Created October 15, 2020 19:38
e-commerce-starter
import React, { useState } from 'react';
// Ant Design
import { Layout } from 'antd';
const { Content, Footer } = Layout;
// Header
import HeaderComponent from './Header';
// Stripe
@AlbionaHoti
AlbionaHoti / CheckoutForm.js
Last active October 30, 2020 22:53
e-commerce-starter
// Ant design
import { Button, Form } from 'antd';
// React context
import { CartContext, TotalContext } from '../context/Context';
import { Col, Row } from 'antd';
import React, { useContext, useState } from 'react';
// Components
import { BillingDetailsFields } from './BillingDetailsField';
// styled components
@AlbionaHoti
AlbionaHoti / ProductList.js
Last active October 30, 2020 20:26
e-commerce-starter
// Apollo
import { useQuery, gql } from '@apollo/client';
// Ant design
import { Row, Col } from 'antd';
// Components
import ProductCard from './Product';
export const QUERY = gql`
@AlbionaHoti
AlbionaHoti / apolloClient.js
Last active October 15, 2020 00:05
e-commerce-starter
import { useMemo } from 'react'
import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client'
let apolloClient
function createApolloClient() {
return new ApolloClient({
ssrMode: typeof window === 'undefined',
link: new HttpLink({
uri: process.env.CONTENT_DELIVERY_API_URL,
@AlbionaHoti
AlbionaHoti / _app.js
Last active October 20, 2020 22:02
e-commerce-starter
import '../assets/antd-custom.less';
// Layout Component
import LayoutComponent from '../components/Layout';
// React Context
import { CartProvider } from '../context/Context';
// Apollo
import { ApolloProvider } from '@apollo/client';
import { useApollo } from '../lib/apolloClient';
@AlbionaHoti
AlbionaHoti / payment_intents.js
Created October 11, 2020 22:37
webiny-starter-e-commerce-nextjs-stripe
import Stripe from 'stripe'
const stripe = new Stripe(
'STRIPE_SECRET_KEY_HERE'
)
export default async (req, res) => {
if (req.method === 'POST') {
try {
const { amount, paymentIntentId } = JSON.parse(req.body)
@AlbionaHoti
AlbionaHoti / CheckoutForm.js
Last active October 11, 2020 22:26
webiny-starter-e-commerce-nextjs-stripe
import React, { useState, useContext } from 'react'
import Router from 'next/router'
// Stripe
import { CardElement, useStripe, useElements } from '@stripe/react-stripe-js'
import { destroyCookie } from 'nookies'
// React context
import { CartContext, TotalContext } from '../context/Context'
@AlbionaHoti
AlbionaHoti / checkout.js
Last active October 11, 2020 21:14
webiny-starter-e-commerce-nextjs-stripe
import React from 'react'
import Stripe from 'stripe'
import { parseCookies, setCookie } from 'nookies'
import { loadStripe } from '@stripe/stripe-js'
import { Elements } from '@stripe/react-stripe-js'
// Components
import CheckoutForm from '../components/CheckoutForm'
// initialize the stripe library and create a payment intent
@AlbionaHoti
AlbionaHoti / index.js
Last active October 11, 2020 18:25
webiny-starter-e-commerce-nextjs-stripe
import React, { useState } from 'react'
// Ant design
import { Input } from 'antd'
const { Search } = Input
import ProductList, { QUERY } from '../components/ProductList' // QUERY -> returns the producst and categories data
// Apollo