aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/Icon.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-07-26 13:22:00 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:55 +0300
commitf707d3d524d8d16e2bb780764f029d85fc57ecc0 (patch)
tree1580074a665bd16c9744b5749c2a777700c5ae73 /vnext/src/ui/Icon.js
parent6016b0888e77497e15384f1cd024eb42672129a4 (diff)
prop-types -> jsdoc
Diffstat (limited to 'vnext/src/ui/Icon.js')
-rw-r--r--vnext/src/ui/Icon.js26
1 files changed, 21 insertions, 5 deletions
diff --git a/vnext/src/ui/Icon.js b/vnext/src/ui/Icon.js
index faf1a704..255bba34 100644
--- a/vnext/src/ui/Icon.js
+++ b/vnext/src/ui/Icon.js
@@ -1,7 +1,19 @@
-import React from 'react';
+import React, { memo } from 'react';
import PropTypes from 'prop-types';
-const Icon = React.memo(props => {
+/**
+ * @typedef {Object} IconProps
+ * @property {string} size
+ * @property {string=} className
+ * @property {string} name
+ * @property {boolean=} noFill
+ */
+
+ /**
+ * Icon inner component
+ * @param {IconProps} props - icon props
+ */
+function IconElement(props) {
var size = props.size ? ' icon--' + props.size : '';
var className = props.className ? ' ' + props.className : '';
var klass = 'icon' + (!props.noFill ? ' icon--' + props.name : '') + size + className;
@@ -14,8 +26,12 @@ const Icon = React.memo(props => {
{ className: klass },
wrapSpinner(Icon, klass)
);
-});
+}
+/**
+ * @param {React.ReactElement} Html
+ * @param {string} klass
+ */
function wrapSpinner(Html, klass) {
if (klass.indexOf('spinner') > -1) {
return React.createElement(
@@ -28,9 +44,9 @@ function wrapSpinner(Html, klass) {
}
}
-export default Icon;
+export default memo(IconElement);
-Icon.propTypes = {
+IconElement.propTypes = {
size: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
className: PropTypes.string,