-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Include some advice on using styles #735
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
Conversation
* that are used by that specific component. This is why all class names start | ||
* with "App" in this example. Instead of defining nested selectors for child | ||
* components, we recommend passing all relevant information as props (such as | ||
* <Button color="red" size="large" />) in React. Then you can have <Button /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case it seems like you are going to directly inline all those styles. One common pattern is to pass down high level props like size={"large" | "medium" | "small"} and then use those to add the class App-size-large, App-size-medium...
I would expand a tiny bit your "nested selector" explanation to explain what I mentioned above. I think this should cover a lot of use cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, this is what I meant! I’ll figure out how to rephrase this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not to recommend BEM notation for elements and modifiers?
@@ -1,3 +1,8 @@ | |||
/** | |||
* This is a good place to put styles that apply to the whole page. | |||
* We recommend to put component-specific styles into separate files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nit picky but "We recommend to put" sounds a bit odd, how about "We recommend putting"
Meh. |
@vjeux @lacker
Plz review.
Related to #642 (comment).
I think it’s not super obvious why those files are split and we have a chance to gently nudge people towards writing more component-oriented CSS if we explain what we mean.