Skip to content

Allow use of default SVG Icons (e.g. BootStrap Icons) #31

@slimninja

Description

@slimninja

Allow the option of switching from img to svg icons, maybe define defaults using bootstrap-icons?

        let classes = {
            header: {
                fg: '',
                bg: '',
                icon: ''
            },
            subtitle: 'text-white',
            dismiss: 'text-white'
        };
        switch (type) {
            case 'info':
                classes.header.bg = $.toastDefaults.style.info || 'bg-info';
                classes.header.fg = $.toastDefaults.style.info || 'text-white';
                classes.header.icon = `<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-exclamation-circle-fill mr-2" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
                                          <path fill-rule="evenodd" d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/>
                                       </svg>`;
                break;
        html += `<div class="toast-header ${classes.header.bg} ${classes.header.fg}">`;

        html += classes.header.icon;
        
        html += `<strong class="mr-auto">${title}</strong>`;

image

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions