Shorthand use case to defining variants #796
-
Is there any shorthand use case to variant definition? variants: {
spaceY: {
1: {
spaceY: "$1"
},
5: {
spaceY: "$5"
},
10: {
spaceY: "$10"
}
}
} I would like to use this instead of code above: variants: {
spaceY: {
1: "$1",
5: "$5",
10: "$10"
}
} Also that might be a feature idea if its possible. |
Beta Was this translation helpful? Give feedback.
Answered by
lukemorales
Sep 17, 2021
Replies: 1 comment 1 reply
-
Your idea is very similar to this PR implementation: #721, they're discussing if this feature fits the plans for Stitches. But your approach with the PR would become: variants: {
spaceY: (value: 1 | 5 | 10) => ({
spaceY: value
)}
} or even better, if you want that to be dynamic with every space token: variants: {
spaceY: (value: Stitches.ScaleValue<'space'>) => ({
spaceY: value
)}
} then you would be able to use: <Component spaceY="$5" /> |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
kerimcet
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your idea is very similar to this PR implementation: #721, they're discussing if this feature fits the plans for Stitches.
But your approach with the PR would become:
or even better, if you want that to be dynamic with every space token:
then you would be able to use: