v2.5.0
createStyled: Export and add extraArguments feature
This update exports the createStyled factory function, which is used
to create the primary styled() styled component function.
createStyled was enhanced with a special argument called extraArguments.
This allows for a creation of styled() with unique + convenient built-in
props. By default, only theme is provided to the styled component.
Example
import { createStyled } from '@helpscout/fancy'
const extraArguments = {
$branding: {
main: '#00ff55'
}
}
const styled = createStyled({ extraArguments })From this point on, any component created with styled will have access to $branding.
const Block = styled('div')`
$({ $branding }) => `
color: ${$branding.main};
`
`Anything can be passed as extraArguments. Other handing things can include functions like rgba or font utils.
Inspiration:
https://github.com/reduxjs/redux-thunk#injecting-a-custom-argument
And
https://baseweb.design/getting-started/installation/#styletron