gitFoxCode / nuxt-icons

Module for Nuxt allowing pleasant use of svg icons
187 stars 23 forks source link

[feature request] Ability to define default properties for the `nuxt-icon` component #24

Closed szulcus closed 1 year ago

szulcus commented 1 year ago

Describe I think it would be nice to give this option to users in the configuration for the module. For example, for the :filled="true" property, my icons often break like this: image ⬇️ image

More complex svg's often require me to manually set the fill="currentColor" attribute. It would be much more convenient if I didn't have to define the filled property every time when I use this component.

gitFoxCode commented 1 year ago

@szulcus Hi, could you please send the SVG code of these icons so I can work on it?

szulcus commented 1 year ago

@gitFoxCode Of course. These icons are from a designer from my work, but I quickly created something for testing: image image

<svg xmlns="http://www.w3.org/2000/svg" width="14.4" height="14.948" viewBox="0 0 14.4 14.948">
  <path id="test-icon" d="M17.813,5.129H5.425l-.01,12.948H17.8Zm-6.2,9.925A3.451,3.451,0,1,1,15.065,11.6,3.461,3.461,0,0,1,11.614,15.055Z" transform="translate(-4.414 -4.129)" fill="none" stroke="currentColor" stroke-width="2"/>
</svg>

As you can see, sometimes it is necessary to set the fill attribute to none.

gitFoxCode commented 1 year ago

@szulcus You would like the module to have the ability to set each icon to have a filled effect as default? Something like modules: [['nuxt-icons', { default: 'filled' }]]?

szulcus commented 1 year ago

@gitFoxCode chia like this, although I'd prefer something like this:

interface Options {
    defaults: {
        filled: boolean;
        // Other properties
    };
}

Thanks!

DanyAtanov commented 1 year ago

My svgs: image

My icons via nuxt-icon 🧐 image

szulcus commented 1 year ago

@DanyAtanov use filled prop

DanyAtanov commented 1 year ago

O, thank you, missed this part =) Hope soon I can change default fill option, cause most my icons didnt need it.

gitFoxCode commented 1 year ago

@szulcus @DanyAtanov Ok, you are right, there should be such an option available, I will add it in the next update