seanhess / elm-style

DEPRECATED - in favor of elm-css: http://package.elm-lang.org/packages/rtfeldman/elm-css/latest
3 stars 5 forks source link

String used when Int makes more sense #6

Open pdamoc opened 8 years ago

pdamoc commented 8 years ago

There are at least three contexts that I've stumbled upon: zIndex, flexGrow and flexShrink where I expected to input an Int rather than a string.

There might be other cases where a number makes more sense. This should be the properties that require a number or auto | initial | inherit.

Considering the use case, I think it might be safe to ignore the text values (auto | initial | inherit) and use just the numbers.

seanhess commented 8 years ago

This is a good opportunity to discuss what direction we should head. Would it make sense to start switching to using types for some of these? Something like:

type Numeric = Auto | Initial | Inherit | Number Int

The main issue I see with this is that we'll start to get name collisions, since so many things need Auto. Maybe it makes more sense to keep things as strings but provide more helpers like px?

zIndex (num 1)
zIndex auto
zIndex inherit
etc

Thoughts?

seanhess commented 8 years ago

Yeah, or you're right, maybe it's so rare to put in auto and inherit we could safely just accept a number. People could still drop down and specify auto with a string property:

[ zIndex 1
, ("zIndex", "auto")
]
pdamoc commented 8 years ago

To my understanding inline styles work a little bit differently from a static CSS & classes. My reasoning was that auto is often the default and if one wants to change a property, it will seldom be to a default. I have yet to see initial and inherit being used. :)

I do however have a very rudimentary understanding of CSS and there might be things that I miss due to my ignorance.