Skip to content
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

Closed
36 tasks done
mbrookes opened this issue Jan 13, 2016 · 13 comments
Closed
36 tasks done

[Docs] Add title and description to code examples #2927

mbrookes opened this issue Jan 13, 2016 · 13 comments
Labels
docs Improvements or additions to the documentation

Comments

@mbrookes
Copy link
Member

Now that #2888 is closed, we need to add a title and description to each of the examples, following the example in AppBar.

  • AppBar
  • AutoComplete
  • Avatar
  • Badge
  • Card
  • Checkbox
  • CircularProgress
  • DatePicker
  • Dialog
  • Divider
  • DropDownMenu
  • FlatButton
  • FloatingActionButton
  • FontIcon
  • GridList
  • IconButton
  • IconMenu
  • LeftNav
  • LinearProgress
  • List
  • Menu
  • Paper
  • Popover
  • RadioButton
  • RaisedButton
  • RefreshIndicator
  • SelectField
  • Slider
  • Snackbar
  • SvgIcon
  • Table
  • Tabs
  • TextField
  • TimePicker
  • Toggle
  • Toolbar
@mbrookes
Copy link
Member Author

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.

@oliviertassinari
Copy link
Member

I would pick the second one. And enforce https://github.com/airbnb/javascript/tree/master/react#alignment.

@newoga
Copy link
Contributor

newoga commented Jan 13, 2016

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

@mbrookes
Copy link
Member Author

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" />

@oliviertassinari oliviertassinari added the docs Improvements or additions to the documentation label Jan 14, 2016
@oliviertassinari
Copy link
Member

Edit: Hmm, this seems to contradict itself:

Well, we have to take into account that we enforce
react/jsx-max-props-per-line: [2, {maximum: 4}] and max-len: [2, 120, 4].

@mbrookes
Copy link
Member Author

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.

@oliviertassinari
Copy link
Member

Shall I simplify the import names

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';

@newoga
Copy link
Contributor

newoga commented Jan 14, 2016

@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 ./src instead ./docs at the moment 😄

@mbrookes
Copy link
Member Author

Yeah, I'm probably going to come back to that at this stage.

@mbrookes
Copy link
Member Author

Aaaaand - were done! : 🎉

@newoga
Copy link
Contributor

newoga commented Jan 23, 2016

yes

👏 👏

@mbrookes
Copy link
Member Author

LOL 😆

@alitaheri
Copy link
Member

Thanks a lot @mbrookes

@newoga Epic 😆 😆

@oliviertassinari Time for a release 😎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

No branches or pull requests

4 participants