Skip to content

Commit

Permalink
docs(ComponentDoc): add sub component descriptions (#462)
Browse files Browse the repository at this point in the history
  • Loading branch information
levithomason committed Sep 2, 2016
1 parent b246613 commit 91e6064
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions docs/app/Components/ComponentDoc/ComponentDoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import docgenInfo from '../../docgenInfo.json'

import { META } from 'src/lib'
import * as stardust from 'src'
import { Grid, Header, Icon, List } from 'src'
import { Divider, Grid, Header, Icon, List } from 'src'

const docgenPaths = _.keys(docgenInfo)

Expand Down Expand Up @@ -44,6 +44,11 @@ const showPropsStyle = {
cursor: 'pointer',
}

const subDescriptionStyle = {
fontSize: '1.08em',
color: '#777',
}

const linkListStyle = {
position: 'absolute',
padding: '0.5em',
Expand Down Expand Up @@ -148,6 +153,7 @@ export default class ComponentDoc extends Component {
)))

const hasSubComponents = !_.isEmpty(subComponents)
const showSubDescription = hasSubComponents && _.get(selectedDocgen, 'docBlock.description')

const subComponentItems = _.map(subComponents, ({ _meta: { name } }) => (
<div key={name} className={itemCX(name)} onClick={() => this.toggleProps(name)}>
Expand Down Expand Up @@ -176,7 +182,12 @@ export default class ComponentDoc extends Component {
</div>
{selectedDocgen && (
<div>
<br />
{showSubDescription && (
<div style={subDescriptionStyle}>
{selectedDocgen.docBlock.description}
<Divider />
</div>
)}
<ComponentProps props={selectedDocgen.props} />
</div>
)}
Expand Down

0 comments on commit 91e6064

Please sign in to comment.