From 3b59438c2f12936b408c88913d56a7c0f8275664 Mon Sep 17 00:00:00 2001 From: renrizzolo Date: Fri, 1 Oct 2021 16:35:28 +1000 Subject: [PATCH] fix: add docs for component methods --- www/containers/Props.jsx | 69 ++++++++++++++++++++++++++++++++++++++ www/containers/styles.scss | 13 +++++++ 2 files changed, 82 insertions(+) diff --git a/www/containers/Props.jsx b/www/containers/Props.jsx index af3fe5ffd..7384ded52 100644 --- a/www/containers/Props.jsx +++ b/www/containers/Props.jsx @@ -59,6 +59,75 @@ const Props = ({ componentName, customMapper }) => { + {componentProps.methods && componentProps.methods.length > 0 && ( + <> +

Methods

+ {_.map(componentProps.methods, (method) => { + return ( +
+
+

+ + {HtmlParser(_.get(method, 'name'), '')} ( + {method.params.map((param, i) => ( + + {param.name} + {param.optional && '?'} + {param.type?.name && `: ${HtmlParser(_.get(param, 'type.name'), '')}}`} + {i !== method.params.length - 1 && ', '} + + ))} + ){method.returns?.type && ` => ${HtmlParser(_.get(method, 'returns.type.name'), '')}`} + +

+ {method.description && ( +

+ Description + {HtmlParser(method.description)} +

+ )} + {method.returns && ( +

+ Returns + {HtmlParser(_.get(method, 'returns.type.name'), '')} + {_.get(method, 'returns.description') && + ` - ${HtmlParser(_.get(method, 'returns.description'), '')}`} +

+ )} +
+ {method.params && method.params.length > 0 && ( + <> + + + + + + + + + + + {_.map(method.params, (param) => ( + + + + + + + ))} + +
ParamRequiredTypeDescription
+ {HtmlParser(_.get(param, 'name'), '')} + + {!param.optional && 'true'} + {param.type && {HtmlParser(_.get(param, 'type.name'), '')}}{param.description && HtmlParser(_.get(param, 'description'), '')}
+ + )} +
+ ); + })} + + )} ); } diff --git a/www/containers/styles.scss b/www/containers/styles.scss index 3ce5e4a17..3b80baefd 100644 --- a/www/containers/styles.scss +++ b/www/containers/styles.scss @@ -96,6 +96,19 @@ body { margin-top: 10px; } + .aui--docs-method-block { + border: 1px solid $color-gray-lighter; + margin-bottom: 20px; + + .aui--docs-method-details { + padding: 10px; + } + + .table { + margin-bottom: 0; + } + } + .aui--docs-note-panel { .text { &-blue {