ohanhi / elm-native-ui

[CLOSED] Experiment: mobile apps in Elm using React Native.
BSD 3-Clause "New" or "Revised" License
1.54k stars 76 forks source link

implementation of stylesheets #80

Closed gabrielperales closed 7 years ago

gabrielperales commented 7 years ago

This should close #17

gabrielperales commented 7 years ago

I have updated the counter example to test stylesheets, and seems to work.

You can try it here https://github.com/gabrielperales/elm-native-ui/tree/stylesheet-example

ohanhi commented 7 years ago

Thank you! The code seems reasonable to me in general. What were the design concerns you had about this?

gabrielperales commented 7 years ago

I did a new type and i called it as stylesheet, maybe it should have another name like styleId and the function to assign those could be stylesIds instead of stylesheet again

ohanhi commented 7 years ago

To me, an opaque type would make the most sense. So instead of

type alias StyleSheet =
    Int

we would have

type StyleSheet
    = StyleSheet Int

This would hide the details (of how the reference is passed) from the user and there would be no way to see that it's really just a number.

gabrielperales commented 7 years ago

Ok, if you are happy with that and you think the type names are Ok, I can just do those changes and remove the WIP status.