Skip to content

Instantly share code, notes, and snippets.

@kktam
kktam / gist:6248422d4204be1dee0d70932ec80886
Created October 10, 2019 04:03
Combining CSS image loading and SASS in next.config.js
const withCSS = require("@zeit/next-css");
const cssConfig = withCSS({
cssModules: true,
webpack: config => {
config.module.rules.push({
test: /\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
use: {
loader: "url-loader",
options: {
limit: 100000,
@kktam
kktam / NavBar.js
Created September 9, 2019 18:16
NavBar.js using auth0 react-auth0-wrapper.js wrapper
// Full implementation of the NavBar.js, as suggested by auth0
// to use the react-auth0-wrapper.js login wrapper
// https://auth0.com/docs/quickstart/spa/react/#create-the-navbar-component
import React, { useState } from "react";
import { Link as RouterNavLink } from "next/link";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
Collapse,
Container,
@kktam
kktam / react-auth0-wrapper.js
Created September 9, 2019 18:13
react-auth0-wrapper.js
// reference from auth0 React quickstart guide
// https://auth0.com/docs/quickstart/spa/react/#install-the-auth0-react-wrapper
// src/react-auth0-wrapper.js
import React, { useState, useEffect, useContext } from "react";
import createAuth0Client from "@auth0/auth0-spa-js";
const DEFAULT_REDIRECT_CALLBACK = () =>
window.history.replaceState({}, document.title, window.location.pathname);
export const Auth0Context = React.createContext();