airbnb / Showkase

🔦 Showkase is an annotation-processor based Android library that helps you organize, discover, search and visualize Jetpack Compose UI elements
https://medium.com/airbnb-engineering/introducing-showkase-a-library-to-organize-discover-and-visualize-your-jetpack-compose-elements-d5c34ef01095
Apache License 2.0
2.13k stars 107 forks source link

StyleName is not working #231

Closed lepicekmichal closed 2 years ago

lepicekmichal commented 2 years ago

StyleName is not working, not even example. Getting just one preview, first one, inside browser activity.

Version: beta12

// Actual component
@Composable
fun CustomButton(
    size: ButtonSize,
    ...
)

// Previews
@ShowkaseComposable(name = "CustomButton", group = "Buttons", defaultStyle = true)
@Composable
fun Preview_CustomButton_Large() {
    CustomButton(size = ButtonSize.Large)
}

@ShowkaseComposable(name = "CustomButton", group = "Buttons", styleName = "Medium size")
@Composable
fun Preview_CustomButton_Medium() {
    CustomButton(size = ButtonSize.Medium)
}

@ShowkaseComposable(name = "CustomButton", group = "Buttons", styleName = "Small size")
@Composable
fun Preview_CustomButton_Small() {
    CustomButton(size = ButtonSize.Small)
}
lepicekmichal commented 2 years ago

Also, could the styleName be made into array of styles?

lepicekmichal commented 2 years ago

Taking back, just noticed how it works. Could you maybe just make it more obvious that mutliple styles are nested? I couldn't tell it's after click that I see all options.

For example, add number of nested styles

vinaygaba commented 2 years ago

@lepicekmichal I added some more documentation in this section of the README. Do take a look and let me know if this isn't clear - https://github.com/airbnb/Showkase#representing-component-styles-in-showkase