marcio / react-skylight

A react component for modals and dialogs
http://marcio.github.io/react-skylight/
MIT License
571 stars 97 forks source link

Unignore styles-examples? #3

Closed bebraw closed 9 years ago

bebraw commented 9 years ago

It would be possible to consume the library CSS directly through a require using Webpack if it was provided with the project. If you unignored styles-examples, then you could do require('react-skylight/styles-examples/default.css'). Maybe it would be even better to push default.css to project root as that would clean up the require even further.

marcio commented 9 years ago

Hi @bebraw, my original idea is not add any css file dependency. In this moment i'm thinking in an approach more encapsulated, something like this https://speakerdeck.com/vjeux/react-css-in-js.

What you think about this?

bebraw commented 9 years ago

This is something I'm currently struggling with in my React components. It is true that styles could be written inline with React but how about customization? Does this mean you should be able to provide style property with possibly nested style declarations to the component? How does this fit the workflow of people (I guess many still prefer CSS files)?

For now I've stuck with classes + separate CSS kind of approach. Having a premade template in the dist costs nothing so I see no reason to exclude it.

Maybe the ideal is somewhere in between? So you would have classes set up according to some convention, say Suit CSS and provide style property. The problem with sticking to some convention like Suit CSS is that everyone seems to use their own. Regardless which convention you pick, it won't be ideal. It's a difficult problem.

By the way, check out JSS. It seems like a natural fit with React and the approach you linked to.

marcio commented 9 years ago

:+1: