Showkase icon indicating copy to clipboard operation
Showkase copied to clipboard

Render previews when a preview is annotated with more than one @Preview annotation

Open StylianosGakis opened this issue 3 years ago • 1 comments

Whenever I annotate a composable with two @Preview annotations it no longer exists inside the group that it should (and isn't visible whatsoever in the Components list).

My use case is that I have a preview that looks like this

@Preview(
    name = "LargeContainedButton",
    group = "Design System",
)
@Preview(
    name = "LargeContainedButton • dark",
    group = "Design System",
    uiMode = Configuration.UI_MODE_NIGHT_YES,
)
@Composable
fun LargeContainedButtonPreview() {
    AppTheme {
        LargeContainedButton({}) {
            Text("Contained Button (Large)")
        }
    }
}

In order to be able to see both Dark and Day mode on the IDE itself without launching showkase.

I am not sure if there is a better way to do this in the first place which wouldn't produce this problem, but it anyway feels like this should work regardless as it's a normal use case, what do you think?

StylianosGakis avatar Sep 21 '21 10:09 StylianosGakis

I do think that since @Preview supports this, we should support it as well. Unsure about the technical feasibility as I'll have to play with it before I can jump to conclusions but I suspect that this should be possible to do.

vinaygaba avatar Sep 21 '21 16:09 vinaygaba

Hi @vinaygaba, any updates on this?

iamutkarshtiwari avatar Nov 21 '22 16:11 iamutkarshtiwari

@iamutkarshtiwari This has been implemented in this PR - https://github.com/airbnb/Showkase/commit/3dffbac3a955804a21357fbb26f9443f040a1650

Closing this issue.

vinaygaba avatar Nov 21 '22 17:11 vinaygaba