shakee93 / vue-toasted

🖖 Responsive Touch Compatible Toast plugin for VueJS 2+
https://shakee93.github.io/vue-toasted/
MIT License
2.21k stars 195 forks source link

Using fontawesome 5 globally with svg #91

Closed Rstyl3 closed 6 years ago

Rstyl3 commented 6 years ago

Since the old version of fontawesome is depricated. I would like to use the new version icon as a svg and you get to pick the icons you only need. Is this feature already added or is there a work around I could use? or am I doing something wrong?

Old code is like this:

import Vue from 'vue'
import App from './App.vue'
import Toasted from 'vue-toasted'
import fontawesome from '@fortawesome/fontawesome'
import faSolid from '@fortawesome/fontawesome-free-solid'

Vue.use(Toasted, {
  iconPack: 'fontawesome'
})
Vue.toasted.register("success_message", `<p>Deployment Complete!</p>`, {
  type: "success",
  theme: "primary",
  position: "bottom-center",
  duration: 5000,
  singleton: true,
  className: "successMessage",
  icon: "check-square",
  action: {
    icon: "window-close",
    onClick: (e, toastObject) => {
      toastObject.goAway(0);
    }
  }
})

new version doesn't work:

import Vue from 'vue'
import App from './App.vue'
import { library } from '@fortawesome/fontawesome-svg-core'
import { faWindowClose, faSpinner, faCog } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import Toasted from 'vue-toasted'

library.add(faWindowClose,faSpinner, faCog)

Vue.component('font-awesome-icon', FontAwesomeIcon)
Vue.use(Toasted, {
  iconPack: 'fontawesome'
})
Vue.toasted.register("success_message", `<p>Deployment Complete!</p>`, {
  type: "success",
  theme: "primary",
  position: "bottom-center",
  duration: 5000,
  singleton: true,
  className: "successMessage",
  action: {
    icon: "window-close",
    onClick: (e, toastObject) => {
      toastObject.goAway(0);
    }
  }
})

capture

Rstyl3 commented 6 years ago

Closing this since I managed to find a workaround using "custom-class" with my fix commented below https://github.com/shakee93/vue-toasted/pull/65#issue-184698211 . I just had to convert the i tags to svg instead. I'm hoping the issue in https://github.com/shakee93/vue-toasted/issues/57#issue-295512801 will get done so I can use that instead.