Skip to content

Commit

Permalink
fix(docz): parse description of props
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Jul 11, 2019
1 parent 112b88f commit 0672c3e
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions core/docz/src/components/Props.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,10 @@ export const Props: SFC<PropsProps> = ({

const props = useMemo(() => {
const props = get('props', definition || firstDefinition)
if (props) {
for (const key of Object.keys(props)) {
if (props[key].description) {
props[key].description = compileMarkdown(props[key].description).tree
}
}
}
return props
return Object.entries(props).reduce((obj, [key, value]) => {
if (key !== 'description') return obj
return { ...obj, description: compileMarkdown(value).tree }
}, props)
}, [compileMarkdown, definition || firstDefinition])

if (!props) return null
Expand Down

0 comments on commit 0672c3e

Please sign in to comment.