Replies: 1 comment 1 reply
-
Redwood deals only in data, so really the choice of how you do this is up to you. You can choose to load a full user-visible string in the presentation layer and pass it to the rendering layer, or you can pass something else like an identifier that indicates which string to load at the rendering layer. If you load at the presentation layer you have to pipe down information like the user's locale yourself and do appropriate matching. If you do it at the rendering layer you can let each OS handle that, but you also have to potentially pass all the formatting arguments as raw data up through. For colors you have a similar choice. You can pass a semantic color (e.g., "primary blue") as a string or enum and then turn it into an actual color in the rendering layer. Or you could pass an actual ARGB value. It all depends on what it right for your app. Images are fonts are much easier: you basically cannot pass these across the bridge so your only choice is to pass representations. For images we generally pass URLs or an identifier for built-in iconography specific to our design system. For fonts I would recommend again passing across semantics (e.g., primary vs. secondary) and letting the rendering system decide whether that requires bold or not. Similarly for like headers or something passing across a semantic style and applying the right font render-side is the better choice. You can see some of this in our samples, specifically the emoji one, but obviously it's a relatively simple app and doesn't have a lot of opportunity for this. Hopefully in the future we can expand its capabilities. |
Beta Was this translation helpful? Give feedback.
-
How to use resources in redwood, such as String, Image, Colors, Fonts, etc.
Beta Was this translation helpful? Give feedback.
All reactions