https://kotlinlang.org logo
#kobweb
Title
# kobweb
f

Funyinoluwa Kashimawo

10/04/2023, 3:18 PM
I noticed that when my styles are private the generated page is just a white screen but it works fin when it is public
Copy code
val EditorKeyStyle by ComponentStyle {
    base {
        Modifier
            .background(Colors.Transparent)
            .transition(CSSTransition(TransitionProperty.of("background"), duration = <http://300.ms|300.ms>))
    }
    hover {
        Modifier.background(AppColors.Primary.rgb)
    }
}
d

David Herman

10/04/2023, 3:39 PM
Sure, if you look at the generated code (search for main.kt under your build file) you'll understand. But did you miss the huge warning that showed up when you set the style to private?
f

Funyinoluwa Kashimawo

10/04/2023, 10:07 PM
I think I did, I'll check again.
Seen
d

David Herman

10/05/2023, 3:19 AM
I've taken a note to add docs to the README soon, about why ComponentStyle has to be public (you're not the first person to ask about this for sure). I'll try to remember to ping here when I do.
🙌 1
OK! Added a brief section to the README about why component styles must be public: https://github.com/varabyte/kobweb#componentstyle
(Applies to component variants and keyframes as well)
If you read that, let me know if it's clear or if anything still doesn't make sense
4 Views