framework/js/lib/helpers/icon.js

13 lines
395 B
JavaScript
Raw Normal View History

/**
* The `icon` helper displays a FontAwesome icon. The fa-fw class is applied.
*
* @param {String} name The name of the icon class, without the `fa-` prefix.
* @param {Object} attrs Any other attributes to apply.
* @return {Object}
*/
export default function icon(name, attrs = {}) {
attrs.className = 'icon fa fa-' + name + ' ' + (attrs.className || '');
return <i {...attrs}/>;
2015-04-25 20:58:39 +08:00
}