Is it possible to combine multiple `PClass`es? Fo...
# kilua
s
Is it possible to combine multiple `PClass`es? For example I have a button that should have a different
scale
value on
hover
and a different value on `press`/`active`
r
Currently you can only create different classes and use % operator to easily concatenate them:
Copy code
val hover = style(pClass = PClass.Hover) {
    color(Color.Red)
}
val active = style(pClass = PClass.Active) {
    color(Color.Blue)
}
div(hover % active) {
    +"Test"
}
🙌 1
This is also a possible solution (perhaps a bit overcomplicated 😉):
Copy code
val parentClass = style {
    style("> div", pClass = PClass.Hover) {
        color(Color.Red)
    }
    style("> div", pClass = PClass.Active) {
        color(Color.Blue)
    }
}
div(parentClass) {
    div {
        +"Test"
    }
}
😄 1
s
The first one is very convenient 👏 Maybe the API can be updated in a way that it asks for a
vararg
of such pClasses and internally uses this modulus operator only? That'd be awesome to see if it doesn't hurt any other logic. Thank you for both these answers though.. the first one is working perfectly fine 🙌