marcelodolza / iziToast

Elegant, responsive, flexible and lightweight notification plugin with no dependencies.

Home Page:http://izitoast.marcelodolza.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SVG Sprite icons

SamMousa opened this issue · comments

commented

SVG Sprite icons use a HTML snippet like this:

<svg class="icon icon-admin"><use href="/assets/e49e1d21/symbol-defs.svg#icon-admin"></use></svg>

This could be implemented with the following changes:

  1. Add iconTag, with default <i>. This allows us to change it (developers might use different tags for things like font-awesome, <span> for example).
  2. Allow HTML in iconText.

Configuration would then be:

{
    icon: 'icon icon-admin',
    iconText: '<use href="/assets/e49e1d21/symbol-defs.svg#icon-admin">',
    iconTag: 'svg'
}

It would be even cleaner (from a configuration perspective) if we add support for some simple string replacements:

{
    icon: 'icon icon-admin',
    iconUrl: "/assets/e49e1d21/symbol-defs.svg",
    iconText: '<use href="{iconUrl}#icon-admin">',
    iconTag: 'svg'
}

But this makes the code more complex..

Hi @SamMousa , could you make a PR? thanks