From 15bd4f661b03d5b96614c90dbd9b32dbd4133cb3 Mon Sep 17 00:00:00 2001 From: Lucas Henrique Date: Mon, 5 Oct 2020 19:06:08 -0300 Subject: [PATCH] Convert icon helper to Typescript (#2360) --- framework/core/js/src/common/helpers/icon.js | 12 ------------ framework/core/js/src/common/helpers/icon.tsx | 13 +++++++++++++ 2 files changed, 13 insertions(+), 12 deletions(-) delete mode 100644 framework/core/js/src/common/helpers/icon.js create mode 100644 framework/core/js/src/common/helpers/icon.tsx diff --git a/framework/core/js/src/common/helpers/icon.js b/framework/core/js/src/common/helpers/icon.js deleted file mode 100644 index c69a5d6c4..000000000 --- a/framework/core/js/src/common/helpers/icon.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * The `icon` helper displays an icon. - * - * @param {String} fontClass The full icon class, prefix and the icon’s name. - * @param {Object} attrs Any other attributes to apply. - * @return {Object} - */ -export default function icon(fontClass, attrs = {}) { - attrs.className = 'icon ' + fontClass + ' ' + (attrs.className || ''); - - return ; -} diff --git a/framework/core/js/src/common/helpers/icon.tsx b/framework/core/js/src/common/helpers/icon.tsx new file mode 100644 index 000000000..cb01a1347 --- /dev/null +++ b/framework/core/js/src/common/helpers/icon.tsx @@ -0,0 +1,13 @@ +import * as Mithril from 'mithril'; + +/** + * The `icon` helper displays an icon. + * + * @param fontClass The full icon class, prefix and the icon’s name. + * @param attrs Any other attributes to apply. + */ +export default function icon(fontClass: string, attrs: Mithril.Attributes = {}): Mithril.Vnode { + attrs.className = 'icon ' + fontClass + ' ' + (attrs.className || ''); + + return ; +}