8000 String used when Int makes more sense · Issue #6 · seanhess/elm-style · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

String used when Int makes more sense #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pdamoc opened this issue Jun 6, 2016 · 3 comments
Open

String used when Int makes more sense #6

pdamoc opened this issue Jun 6, 2016 · 3 comments

Comments

@pdamoc
Copy link
pdamoc commented Jun 6, 2016

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
Copy link
Owner
seanhess commented Jun 6, 2016

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
Copy link
Owner
seanhess commented Jun 6, 2016

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
Copy link
Author
pdamoc commented Jun 6, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0