Skip to content

Instantly share code, notes, and snippets.

View guybeaumont's full-sized avatar

Guy Beaumont guybeaumont

View GitHub Profile
@mikehwagz
mikehwagz / analytics.js
Last active January 31, 2021 02:12
basic gtm pattern + enhanced commerce
const BRAND_NAME = 'Lorem Ipsum'
export function gtmProduct(product, variant) {
return {
name: product.title,
id: variant.sku,
price: parseFloat(variant.price),
variant: variant.title,
brand: BRAND_NAME,
category: 'All',
@mikehwagz
mikehwagz / _app.js
Created August 22, 2020 13:14
Page transitions with GSAP in Next.js
import { SwitchTransition, Transition } from 'react-transition-group'
import gsap from 'gsap'
function MyApp({ Component, pageProps, router }) {
return (
<SwitchTransition>
<Transition
key={router.pathname}
timeout={500}
in={true}
import { createContext, useEffect, useState, useMemo, useContext } from 'react';
import cookie from 'js-cookie';
import firebase from 'lib/auth/firebase';
import { useDocument } from '@nandorojo/swr-firestore';
import type { UserModel } from 'types/UserModel';
// Create a context that will hold the values that we are going to expose to our components.
// Don't worry about the `null` value. It's gonna be *instantly* overriden by the component below
type UserContextType = {
user: UserModel | null;