Skip to content
This repository has been archived by the owner on Mar 1, 2021. It is now read-only.

use of style inside jsx files #122

Open
MAKIO135 opened this issue Jul 26, 2016 · 4 comments
Open

use of style inside jsx files #122

MAKIO135 opened this issue Jul 26, 2016 · 4 comments
Labels

Comments

@MAKIO135
Copy link
Member

Shouldn't we move all style properties to scss files?
Or should we move everything into jsx files?

@MAKIO135
Copy link
Member Author

ok, since Material UI inlines CSS, we have to put additional styles in jsx files, do we put everything in jsx then?

@clemsos
Copy link
Member

clemsos commented Jul 27, 2016

I will say

  • Sass for styling at the app level (typo, layout, etc)
  • Inline CSS at the component level

A while backed I noticed this rep which may help to decide https://github.com/MicheleBertoli/css-in-js

@clemsos
Copy link
Member

clemsos commented Jul 27, 2016

For inline styling , a nice convention is to have a styles object at the top of the .jsx file with all the styling inside

const styling = {
  WeirdButton : {
    marginTop : '2em'
  }
}

Then just pass it to the component afterwards

<WeirdButton style={styling.WeirdButton} />

@clemsos
Copy link
Member

clemsos commented Oct 27, 2017

So far, tstyling is done by a mix of 1) maintaining a separate .scss file in the component folder to store general styling and 2) use .jsx inline css to style dynamically what changes

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

No branches or pull requests

2 participants