wix-storybook-utils
Version:
Utilities for automated component documentation within Storybook
44 lines • 1.92 kB
JavaScript
import React from 'react';
import styles from './styles.scss';
export var hiddenMethods = [
'UNSAFE_componentWillMount',
'UNSAFE_componentWillReceiveProps',
'UNSAFE_componentWillUpdate',
'componentDidCatch',
'componentDidMount',
'componentDidUpdate',
'componentWillUnmount',
'constructor',
'forceUpdate',
'getDerivedStateFromError',
'getDerivedStateFromProps',
'getSnapshotBeforeUpdate',
'render',
'setState',
'shouldComponentUpdate',
];
export var MethodsTable = function (_a) {
var _b = _a.methods, methods = _b === void 0 ? [] : _b;
return (React.createElement("table", { "data-hook": "autodocs-methods-table", className: styles.table },
React.createElement("thead", null,
React.createElement("tr", null,
React.createElement("th", null, "Name"),
React.createElement("th", null, "Parameters"),
React.createElement("th", null, "Description"))),
React.createElement("tbody", null, methods
.filter(function (_a) {
var name = _a.name;
return !hiddenMethods.includes(name);
})
.map(function (_a) {
var _b = _a.name, name = _b === void 0 ? '' : _b, _c = _a.params, params = _c === void 0 ? [] : _c, _d = _a.description, description = _d === void 0 ? '' : _d;
return (React.createElement("tr", { "data-hook": "autodocs-methods-table-row", key: name },
React.createElement("td", { className: styles.propName }, name),
React.createElement("td", { className: styles.propType }, params.map(function (_a) {
var paramName = _a.name;
return paramName;
}).join(', ')),
React.createElement("td", { className: styles.description }, description)));
}))));
};
//# sourceMappingURL=methods-table.js.map