Created
April 27, 2020 19:09
-
-
Save christianalfoni/831e36488156cc7619b4a9e2b1dd2d5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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