mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 18:12:59 +08:00
Convert icon helper to Typescript (#2360)
This commit is contained in:
parent
9be629cfcc
commit
8c46b37a6f
|
@ -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} />;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user