Skip to content

Instantly share code, notes, and snippets.

View chrstntdd's full-sized avatar

Christian Todd chrstntdd

  • San Francisco, CA
View GitHub Profile
@chrstntdd
chrstntdd / nestedGlobalStyle.ts
Created June 18, 2022 19:48 — forked from roginfarrer/nestedGlobalStyle.ts
nested selectors for vanilla extract globalStyle
import { globalStyle, GlobalStyleRule } from "@vanilla-extract/css";
interface RecursiveGlobalStyle {
[k: string]: GlobalStyleRule | RecursiveGlobalStyle;
}
function globalUtil(selector: string, styles: RecursiveGlobalStyle) {
const write = (
key: string[],
value: RecursiveGlobalStyle | GlobalStyleRule
import React from "react";
import { Link } from "react-router-dom";
export function createResource(getPromise) {
let cache = {};
let inflight = {};
function load(key) {
inflight[key] = getPromise(key).then(val => {
delete inflight[key];