Closed gregberge closed 3 years ago
Quick thought about v3
Right now we can extend x
in a project, but styled
remains as it was, pointed to the original x
. Working around this involves copying the code from the bottom of packages/styled-components/src/styled.ts
to rebuild styled
against the new x
.
Would it make sense to export a creator which would return an object of functions? Similar to createCss
in stitches
For example:
// my-styled-components.js
import * as xstyled from '@xstyled/styled-components'
// my additional generators
const foo = xstyled.style(...)
const bar = xstyled.style(...)
const {css, styled, system, x} = xstyled.create({
generators: [xstyled.system, foo, bar],
// could optionally also override tags
})
export default styled
export {css, system, x}
In fact this would just be a feature, not a breaking change, so it doesn't need to hold up v3. But it would be a significant feature.
@agriffis good idea, you mean for styled.*Box
isn't it? Because for CSS magic prop mapping I don't see a real usecase.
@agriffis good idea, you mean for
styled.*Box
isn't it? Because for CSS magic prop mapping I don't see a real usecase.
Yes, also system
, but more generally you can supply a config and get the full family of customized functions in return.
For example (and please bear with me, I'm just making this up) there might be other configuration items: includeBoxTags: bool
and allTagsAreSystem: bool
because I might prefer styled.p
with system capabitilies, instead of needing to use styled.pBox
. (I can always used styled('p')
to get a non-system component if I really need it.)
Codecov Report
97.61% <ø> (-2.39%)
50.00% <50.00%> (-50.00%)
66.66% <66.66%> (+66.66%)
50.00% <80.00%> (+50.00%)
78.57% <85.71%> (-3.25%)
85.00% <88.88%> (-4.48%)
91.66% <91.30%> (ø)
92.59% <91.83%> (+0.59%)
94.73% <94.73%> (ø)
97.29% <95.45%> (-2.71%)
Continue to review full report at Codecov.