What do you think folk? Is this a cool way to org ...
# compose
p
What do you think folk? Is this a cool way to org a Design System with Compose? 🙂 https://twitter.com/pablisc0/status/1519046447391555584?s=20&t=YzrvR4kNS1X61lYEV-O1gQ
t
This is pretty cool, we’re currently using a parameter to configure the Primary/Secondary variants, but we also don’t expect users to change the variant of a button on the fly, so representing as a parameter to the composable its not a great fit.
🐕 1
enum class + invoke function sure does make it more user friendly
p
Forgot to mention that the initial object solution doesn't work as well with auto complete in Android Studio. There is a bug somewhere that @Javier opened about this. ☺️
t
Oh! I wonder what that issue is about 🤔 Just going through that solution more, it looks like having the variant as a receiver also makes sense because you’re configuring/tailoring the component (i.e. button in this case) to the variant you’re requesting
c
I think Adam Powell went through these sorts of things in this channel in the past. Specifically why something like TextField and OutlinedTextField were chosen to be different things. I think maybe @Louis Pullen-Freilich [G] also went into this here. Really insightful. I like to split up my composables like that now, and try not to have a style var or anything.
t
Oh interesting! Do you remember if there was a specific thread that helped?
👀 1
z
Also curious about why it would be beneficial to use multiple composable functions for a common component! Isnt it easier to have one button composable that also accepts a style (filled/outlined/etc)? Ive used this approach in a large project and Ive seen 0 overlap (e.g. filled also needs some property X which doesnt make sense for outlined, etc).
c
I sweat that i saw this talked about with OutlinedTextField vs TextField, but the only thing I could find in slack was this: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1611087822290800 Throwback to Zach K before he was working at google 😄
👍 1
👍🏽 1
a
1
☝️ 2
☝🏼 1
🙏 1
c
Aha. That's what I was remembering which is why i mentioned Louis Pullen-Freilich. awesome. thank you @Andrey Kulikov
t
Oh great, missed this one, thanks!