Skip to content

Instantly share code, notes, and snippets.

@christianalfoni
Created April 27, 2020 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christianalfoni/831e36488156cc7619b4a9e2b1dd2d5a to your computer and use it in GitHub Desktop.
Save christianalfoni/831e36488156cc7619b4a9e2b1dd2d5a to your computer and use it in GitHub Desktop.
import * as React from 'react'
import { createConfig, TCss } from '@stitches/css'
const config = createConfig({
tokens: {
colors: {
RED: 'tomato',
},
},
})
const context = React.createContext<TCss<typeof config>>(null)
const Provider: React.FC<{ css: TCss<typeof config>}> = ({ children, css }) => {
return <context.Provider value={css}>{children}</context.Provider>
}
const useCss = () => React.useContext(context)
export { config, Provider, useCss }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment