2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00
discourse/app/assets/javascripts/discourse/helpers/fa-icon.js.es6

17 lines
448 B
Text
Raw Normal View History

export function iconHTML(icon, label) {
var html = "<i class='fa fa-" + icon + "'";
if (label) { html += " aria-hidden='true'"; }
html += "></i>";
if (label) {
html += "<span class='sr-only'>" + I18n.t(label) + "</span>";
}
return html;
}
Handlebars.registerHelper('fa-icon', function(icon, options) {
var label;
if (options.hash) { label = options.hash.label; }
return new Handlebars.SafeString(iconHTML(icon, label));
});