Skip to content

Commit

Permalink
feat: Add method examples to the reference template
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jun 5, 2020
1 parent 3f642f3 commit 811b122
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/hooks/useComponentDoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ const useComponentDoc = (componentName) => {
description: methodDocs?.text,
returnValue: methodDocs?.tags.return?.[0] ?? { type: 'undefined' },
params: methodDocs?.tags.param,
examples: methodDocs?.tags.examples ?? [],
};
}),
};
Expand Down
7 changes: 7 additions & 0 deletions src/templates/ReferenceTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ const ReferenceTemplate = ({ data }) => {
params={method.params}
returnValue={method.returnValue}
/>
{method.examples.map((example, i) => (
<ComponentExample
key={i}
className={styles.componentExample}
example={example}
/>
))}
</Fragment>
))}
</section>
Expand Down

0 comments on commit 811b122

Please sign in to comment.