https://kotlinlang.org logo
#compose
Title
# compose
d

darkmoon_uk

07/06/2022, 1:45 AM
This Katalog library looks nice for building Compose Component catalog preview Apps; but it doesn't support Multiplatform - is anyone aware of a similar project that does?
b

Berkeli Alashov

07/06/2022, 1:50 AM
https://github.com/airbnb/Showkase, although not sure if it supports Kotlin multiplatform either
👍 1
👀 1
z

Zoltan Demant

07/06/2022, 9:06 AM
@darkmoon_uk Katalog looks great, thanks for bringing it to my attention! Skowkase is nice, but adding additional clutter to all my composables in order for it to work never felt right to me.
Furthermore, Katalog at least states that theyre considering supporting multiplatform 🙂
👍 1
s

Stylianos Gakis

07/06/2022, 2:22 PM
What clutter do you have to add for showkase? Are you using the ShowkasePreview specifically? Something that the normal Preview doesn’t provide that you need?
z

Zoltan Demant

07/06/2022, 3:10 PM
@Stylianos Gakis I wasnt aware that @Preview worked with Showkase prior to reading your comment actually, thanks for that! At the end of the day I just want to keep my components simple and organized, I have 137 of them and if I were to also dictate their previews in the same place - Id probably just go mad. Perhaps its possible to declare @Preview and @ShowkaseXYZ in another module as well? If so, thatd be just as good as Katalog for me personally!
v

Vinay Gaba

07/06/2022, 8:32 PM
Showkase supports preview out of the box and shouldn't need any other boilerplate apart from a couple lines of code to represent your root module. The other annotation was added for net new functionality but you don't have to use it. If you are already using @Preview in your codebase, Showkase should just work. If it doesn't let me know and I can help you debug it! In addition, it also support automatic screenshot testing. I need to add documentation about it still but there are a few blog posts that talk about it. Disclosure: I wrote the library so this is as biased as it can get 😄
z

Zoltan Demant

07/07/2022, 4:45 AM
@Vinay Gaba Hey, thank you! I ended up experimenting with both libraries last night - I really liked how easily I could setup Showkase, and as an added bonus I could also declare the previews in another module! This probably isnt specific to Showkase, but Id love to be able to automagically wrap all my components with my theme so that I dont have to write
Theme {}
over and over again. Do you reckon that theres a way to do that yet? Otherwise, consider it a feature request! My theme just comes with light/dark variants currently, so the dark variant you generate is awesome.
v

Vinay Gaba

07/07/2022, 5:24 AM
You probably want the theme to also be present for your Android Studio Previews. Even if Showkase somehow generated this for the Showkase browser itself, you probably want to make sure the dev experience is consistent when using Showkase or Android Studio. One idea is to create a util function for all your previews that does the setup for all your previews. You can add a lint rule to ensure that all your preview functions use this wrapper function or something. That's where I'd probably add the logic to add your app theme. Doing this ensures that both AS and Showkase have your theme available in your previews.
👍🏽 1
5 Views