From 8c46b37a6fba3cb060d30d108167e884265b7aa9 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) --- js/src/common/helpers/icon.js | 12 ------------ js/src/common/helpers/icon.tsx | 13 +++++++++++++ 2 files changed, 13 insertions(+), 12 deletions(-) delete mode 100644 js/src/common/helpers/icon.js create mode 100644 js/src/common/helpers/icon.tsx diff --git a/js/src/common/helpers/icon.js b/js/src/common/helpers/icon.js deleted file mode 100644 index c69a5d6c42..0000000000 --- a/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/js/src/common/helpers/icon.tsx b/js/src/common/helpers/icon.tsx new file mode 100644 index 0000000000..cb01a13474 --- /dev/null +++ b/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 ; +}