Compose previews. Top or bottom of the file? I can...
# compose
m
Compose previews. Top or bottom of the file? I can think of reasons for both ways.
⬇️ 27
f
Voted ⬇️ but sometimes Previews can be in completely separate file if there is more of them
👍 1
💯 1
f
I would say it depends on the use case If you're developing apps for yourself (without the possibility of other people using your code), having them at top is also okay - quick preview of the implementation. If you're developing SDKs/components for use elsewhere, the impl is generally more important than the UI, so it can be at the bottom. But yeah, separate files also work as @Filip Wiesner says
m
The argument for top I can think of is that previews serve as documentation/samples, and so similarly to JavaDoc comments go above what they are documenting.
f
Yeah that's a good point - but my POV comes from - if you look up a file, e.g. `TypingIndicator.kt`˛ most of the time you're probably looking to work on the code and/or implement it in another file, so the thing that's most common should be at the top in that case (the code in my opinion) But yeah, you could also say that if you're looking into something regularly, you want to make sure the UI is the same/looks the way you want