Open pdamoc opened 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?
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")
]
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.
There are at least three contexts that I've stumbled upon:
zIndex
,flexGrow
andflexShrink
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 anumber
orauto | 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.