mirror of
https://github.com/flarum/core.git
synced 2025-07-28 04:00:40 +02:00
Convert icon helper to Typescript (#2360)
This commit is contained in:
@@ -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 <i {...attrs} />;
|
|
||||||
}
|
|
13
js/src/common/helpers/icon.tsx
Normal file
13
js/src/common/helpers/icon.tsx
Normal file
@@ -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 <i {...attrs} />;
|
||||||
|
}
|
Reference in New Issue
Block a user