nikgraf / belle

Configurable React Components with great UX
http://nikgraf.github.io/belle/
MIT License
2.51k stars 104 forks source link

JSS for static css #119

Open kof opened 9 years ago

kof commented 9 years ago

I like your code and I would love to see jss (https://github.com/jsstyles/jss) to be used for styling. It would simplify the code in some places and you can get rid of some helper functions. It has also react integration https://github.com/jsstyles/react-jss which basically ensures you have only sheets rendered into document, which are also in use by rendered components. Also jss styles can't clash.

kof commented 9 years ago

I am open for any improvements you might need.

jpuri commented 9 years ago

Thanks @kof , and thanks for this great work (https://github.com/jsstyles/jss). We will definitely consider and evaluate it for belle and get back to you with queries :smile:

nikgraf commented 9 years ago

+1

@kof What are your thoughts about what React Native is doing. I haven't looked into it, but I heard they kind of sort them.

{
  borderLeft: '1px solid red',
  border: '1px solid black'
}

In this case the left border will still be red. Instead of taking the last definition they sort based on the level of detail. Some people would like to see this even for the default React style property. If I'm not mistaken it's even easy to implement, because a more detailed version descriptor is always prefixed with the original e.g paddingLeft has padding as prefix.

kof commented 9 years ago

CSS does basically override, react-native - extends. In CSS you would normally write the border first and then override only the left one. In react native the original order just doesn't matter.

I think the last one is more intuitive and easy.

In jss this can be implemented as a plugin. Core of jss needs to stay slim and close to css.

kof commented 9 years ago

As of implementation detail it can be a simple sort of props by inc length.

kof commented 9 years ago

here you go) https://github.com/jsstyles/jss-props-sort