-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Docs] Add title and description to code examples #2927
Comments
What's the preferred code style (assuming it's under 120 chars)?: <CodeExample code={appBarExampleIconCode} title="Simple Example" description={descriptions.icon} > or <CodeExample
code={appBarExampleIconCode}
title="Simple Example"
description={descriptions.icon}
> There are plenty of examples of each. |
I would pick the second one. And enforce https://github.com/airbnb/javascript/tree/master/react#alignment. |
@mbrookes I was wondering that too. I prefer option 2 personally as I generally follow AirBnb's style guide in my projects. https://github.com/airbnb/javascript/tree/master/react#props Yeah, what @oliviertassinari said. Haha. |
Good for me. 👌 Edit: Hmm, this seems to contradict itself: // if props fit in one line then keep it on the same line
<Foo bar="bar" /> |
Well, we have to take into account that we enforce |
That's why I was confused 😕 the first example also meets the AirBNB guidlelines and the linting rules. However since you've said the second form is preferred, that's what I've gone with. Shall I simplify the import names, or leave that alone? @newoga was looking at other ways we could simplify or reduce the imports. |
Good question. I personally follow this pattern on my project: import appBarReadmeText from 'AppBar/README';
import AppBarExampleIcon from 'AppBar/ExampleIcon';
import appBarExampleIconCode from '!raw!AppBar/ExampleIcon';
import appBarExampleIconDescription from 'AppBar/exampleIconDescription.md';
import AppBarExampleIconButton from 'AppBar/ExampleIconButton';
import appBarExampleIconButtonCode from '!raw!AppBar/ExampleIconButton';
import AppBarExampleIconMenu from 'AppBar/ExampleIconMenu';
import appBarExampleIconMenuCode from '!raw!AppBar/ExampleIconMenu';
import appBarCode from '!raw!material-ui/lib/app-bar'; |
@mbrookes Feel free to follow the pattern @oliviertassinari presented here. I think there is room to wrap some of the logic that does this importing but that can come later. I don't think it'll be wasted effort to move forward with defining proper name/descriptions for all the examples if we have to refactor imports later. I'm currently prioritizing refactoring under |
Yeah, I'm probably going to come back to that at this stage. |
Aaaaand - were done! : 🎉 |
LOL 😆 |
Thanks a lot @mbrookes @newoga Epic 😆 😆 @oliviertassinari Time for a release 😎 |
Now that #2888 is closed, we need to add a title and description to each of the examples, following the example in AppBar.
The text was updated successfully, but these errors were encountered: