Skip to content

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

Closed
wants to merge 1 commit into from
Closed

Conversation

gaearon
Copy link
Contributor

@gaearon gaearon commented Sep 24, 2016

@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.

@gaearon gaearon mentioned this pull request Sep 24, 2016
@ghost ghost added the CLA Signed label Sep 24, 2016
@ghost ghost added the CLA Signed label Sep 24, 2016
* 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 />
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link

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.
Copy link
Contributor

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"

@gaearon
Copy link
Contributor Author

gaearon commented Nov 20, 2016

Meh.

@gaearon gaearon closed this Nov 20, 2016
@gaearon gaearon deleted the style-suggestions branch March 6, 2017 02:40
@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants