-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow property values to be style objects #37
Comments
Hey, this is a super cool idea! Really into it. It gets me thinking about what can be done with this to optimize shorthands like In terms of devising the API for configuration with
|
Hey @roginfarrer 👋 You're absolutely right, support for multiple values would actually be needed in this example to support multiple kinds of transformations. That's actually how tailwind works with transform: translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); I guess in terms of API, I guess we could somehow get close to the vanilla-extract syntax 🤔 const properties = defineProperties({
dynamicProperties: {
transform: {
vars: {
translateX: true,
translateY: true,
rotate: true,
},
transform:`translate(${translateX}, ${translateY}) rotate(${rotate}) ...`,
}
}
}); Then to use it rainbowSprinkles({
transform: {translateX: '10px', ...}
}); |
Automatically marking issue as stale due to lack of activity |
Automatically marking issue as stale due to lack of activity |
Automatically closing this issue as stale |
Automatically marking issue as stale due to lack of activity |
Problem Statement
Rainbow Sprinkles currently doesn't accept style objects as values when defining
dynamicProperties
.This could be useful when using complex CSS properties like
transform
, which lets yourotate
,scale
,skew
, ortranslate
an element.The only way at the moment to
rotate
ortranslate
an element with Rainbow Sprinkles is to define thetransform
property with dynamic values as follows:Which forces you to dynamically construct the full transformation value, when only the
length
value could be providedThis also means you have to manually handle in JS things like
rtl
direction, while this could be automated 😞Proposed Solution
As with regular Sprinkles properties, it would be great if the values could be entire style objects. This would make for even more powerful classes.
Which would automatically produce the following classes
The text was updated successfully, but these errors were encountered: