man15h / vue-cryptoicon

Cryptocurrency icons for your next Vue project
https://vue-cryptoicon.netlify.com/
MIT License
101 stars 28 forks source link

Shouldn't it return generic icon if symbol not found #1

Open abhishekgahlot opened 5 years ago

abhishekgahlot commented 5 years ago

Generally, its a good idea if a symbol isn't present to return a generic icon. I do see you have written a code for this here:

CryptoIcon.vue

I think when someone is iterating over lots of symbols and if the symbol isn't found in this library it should return generic but as of now, I get an error in console.

Maybe we should remove that else part and return generic, If you agree I can raise a PR for that.

man15h commented 5 years ago

If you use Vue.use(Cryptoicon, { size: '50', color: 'black', generic: true }); it will fallback to the generic in case of icon is missing. Also for a single icon, you can pass generic prop <cryptoicon symbol="btc" size="24" generic />. It isn't enabled by default so that someone can know which icon is available.

abhishekgahlot commented 5 years ago

Sure, Yeah that's what I saw. I have to disagree and would consider enabling it by default so that if someone is building an app he doesn't have to handle lots of image loading error.

man15h commented 5 years ago

Okay, I'll consider this and make the generic icon fallback true by default. although it will still show the error in the console.

abhishekgahlot commented 5 years ago

Thanks @man15h, I pushed the code long back for generic icon here though: https://github.com/abhishekgahlot/vue-cryptoicon/commit/b66875f4dd9f5a23f649b368adab0080935c55c2

Also, one more thing I see after installing this package the folder size is really really huge. I think we should decrease the size it looks really big to me.

WhatsApp Image 2019-04-18 at 3 27 38 PM

man15h commented 5 years ago

Probably that might be because of the submodule. I'll look into it. Thanks