From 811b1221b4a9d607ad5e93b26ee471c1c7b73e07 Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Fri, 5 Jun 2020 12:59:56 -0700 Subject: [PATCH] feat: Add method examples to the reference template --- src/hooks/useComponentDoc.js | 1 + src/templates/ReferenceTemplate.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/hooks/useComponentDoc.js b/src/hooks/useComponentDoc.js index abaed6a74..36da0b7d5 100644 --- a/src/hooks/useComponentDoc.js +++ b/src/hooks/useComponentDoc.js @@ -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 ?? [], }; }), }; diff --git a/src/templates/ReferenceTemplate.js b/src/templates/ReferenceTemplate.js index 1c29b70a8..081bb1503 100644 --- a/src/templates/ReferenceTemplate.js +++ b/src/templates/ReferenceTemplate.js @@ -94,6 +94,13 @@ const ReferenceTemplate = ({ data }) => { params={method.params} returnValue={method.returnValue} /> + {method.examples.map((example, i) => ( + + ))} ))}