Tristan
09/15/2021, 8:59 PMobject BoardCssVariable {
val translateOrigin by variable<StylePropertyString>()
}
The current examples are use it in something like
object BoardSheet : StyleSheet() {
val container by style {
BoardCssVariable.translateOrigin("translateY(-150%)")
property("transform", BoardCssVariable.translateOrigin.value())
}
}
But that’s not really useful. I want to change its value depending on some logic. So I ended up doing
Div({
style {
if (myCondition) {
property(BoardCssVariable.translateOrigin.name, "translateY(-150%)")
}
}
}) {}
Is there some ideas to make it more pleasant? Maybe Compose for web could get some handy features via the compiler, some kind of CSS runtime like Emotion? Of course, it is not blocking. Just curious to know what will be the team’s take on that 🙂
Maybe I could have done something like
Div({
classes(BoardSheet.container("translateY(-150%)"))
}) {}
and under the wood, the compiler would have done what I manually did. I don’t know 🤷Akif Abasov [JB]
09/16/2021, 6:26 AM