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 albiona (https://keybase.io/albiona) on keybase.
  • I have a public key ASAjMqQPz1HH-Di418nSbM_nnYej7YESlWNH5rmCClODlgo

To claim this, I am signing this object:

Update the forked repo with git rebase

  1. Add the remote (original repo that you forked) and call it “upstream”

git remote add upstream https://github.com/original-repo/goes-here.git

  1. Fetch all branches of remote upstream

git fetch upstream

@AlbionaHoti
AlbionaHoti / next.config.js
Created October 11, 2020 14:40
webiny-starter-e-commerce-nextjs-stripe
/* eslint-disable */
const withLess = require('@zeit/next-less')
const lessToJS = require('less-vars-to-js')
const fs = require('fs')
const path = require('path')
// Where your antd-custom.less file lives
const themeVariables = lessToJS(
fs.readFileSync(path.resolve(__dirname, './assets/antd-custom.less'), 'utf8')
)
@AlbionaHoti
AlbionaHoti / .babelrc
Created October 11, 2020 14:42
webiny-starter-e-commerce-nextjs-stripe
{
"presets": ["next/babel"],
"plugins": [
[
"import",
{
"libraryName": "antd",
"style": true
}
]
@AlbionaHoti
AlbionaHoti / antd-custom.less
Created October 11, 2020 14:43
webiny-starter-e-commerce-nextjs-stripe
@layout-header-height: 40px;
@border-radius-base: 2px;
@primary-color: #1890ff; // primary color for all components
@link-color: #1890ff; // link color
@success-color: #52c41a; // success state color
@warning-color: #faad14; // warning state color
@error-color: #f5222d; // error state color
@font-size-base: 14px; // major text font size
@heading-color: rgba(0, 0, 0, 0.85); // heading text color
@AlbionaHoti
AlbionaHoti / apolloClient.js
Last active October 11, 2020 18:08
webiny-starter-e-commerce-nextjs-stripe
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, // `.../cms/read/production`
@AlbionaHoti
AlbionaHoti / _app.js
Created October 11, 2020 18:07
webiny-starter-e-commerce-nextjs-stripe
import { ApolloProvider } from '@apollo/client'
import { useApollo } from '../lib/apolloClient'
import { ApolloProvider as ApolloHooksProvider } from '@apollo/react-hooks'
// Layout Component
import LayoutContent from '../components/LayoutContent'
// React Context
import { CartProvider } from '../context/Context'
@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
@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 / 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'