Skip to content

Instantly share code, notes, and snippets.

View iamkevingreen's full-sized avatar
💭
🍝 🍝 🍝 🍝 🍝 🍝

Kevin Green iamkevingreen

💭
🍝 🍝 🍝 🍝 🍝 🍝
View GitHub Profile
import React, {useState, useEffect, useRef} from 'react'
import classNames from 'classnames'
import {useIntersection} from 'use-intersection'
const Video = ({
video,
poster,
posterWidth = 1920,
posterFitMode = 'preserve',
const sanityClient = require('@sanity/client');
const crypto = require('crypto');
const {
SANITY_API_TOKEN,
SANITY_PROJECT_ID,
SANITY_DATASET,
SHOPIFY_SECRET
} = process.env;
import React, { Component } from 'react'
import { Link } from 'react-router'
import AuthService from '../../utils/AuthService'
export default class Home extends Component {
constructor(props, context) {
super(props, context)
this.state = {
profile: props.auth.getProfile()
}
// Handles all the things ajax cart related,
// based around the timber ajax cart, minus the jquery
import serialize from 'form-serialize'
import fetch from 'unfetch'
const RicherAPI = {}
// tacos
RicherAPI.onCartUpdate = (cart) => {
console.log('items in the cart?', cart.item_count)
import React, { Component } from 'react'
import SendBird from 'sendbird'
const SiteStore = require('stores/SiteStore')
const Actions = require('actions/SiteActions')
export default class MemberMessaging extends Component {
constructor(props) {
super(props)
let Parallax = {
init(el, displace) {
this.animateItem(el, displace);
},
setPosition() {
if (window.pageYOffset !== undefined) {
return window.pageYOffset;
} else {
return (document.documentElement || document.body.parentNode || document.body).scrollTop;
}
import React from 'react'
import { Router } from '@reach/router'
import { pageQuery, productQuery, articleQuery } from '../api/preview.js'
import Page from '../templates/page.js'
import Product from '../templates/product.js'
import Editorial from '../templates/editorial.js'
const sanityClient = require('@sanity/client')
const Prismic = require('prismic.io');
const endpoint = 'https://yourrepo.prismic.io/api';
const CMS = Prismic.api(endpoint);
const cursor = Prismic.Predicates;
class API {
query(key, value) {
return CMS.then((api) => {
return api.query(cursor.at(key, value));
import React, { Component } from 'react';
import { render } from 'react-dom';
// Pages
import Home from './pages/home';
if (document.getElementById('Home')) { // eslint-disable-line
render(<HomeLayout />,
document.getElementById('Home') // eslint-disable-line
);
import React, { Component } from 'react';
import API from '../api/prismic';
import Carousel from '../globals/carousel'
import Helper from '../helper';
class Home extends Component {
constructor(props) {
super(props)