1
0
mirror of https://github.com/koloml/philomena-tagging-assistant.git synced 2026-09-22 20:09:39 +00:00

Support creating favicon items of different types

I need that for brand icons. Without specified subtype, will point to
regular solid icons.
This commit is contained in:
2026-08-30 05:27:20 +02:00
parent c23c871337
commit f873cae544

View File

@@ -2,10 +2,11 @@
* Reusable function to create icons from FontAwesome. Usable only for website, since extension doesn't host its own
* copy of FA styles. Extension should use imports of SVGs inside CSS instead.
* @param iconSlug Slug of the icon to be added.
* @param [subtype="solid"] Subtype of the icon. Some icons only exist in specific subtypes.
* @return Element with classes for FontAwesome icon added.
*/
export function createFontAwesomeIcon(iconSlug: string): HTMLElement {
export function createFontAwesomeIcon(iconSlug: string, subtype: string = 'solid'): HTMLElement {
const iconElement = document.createElement('i');
iconElement.classList.add('fa-solid', `fa-${iconSlug}`);
iconElement.classList.add(`fa-${subtype}`, `fa-${iconSlug}`);
return iconElement;
}