ndiego / icon-block

Effortlessly add SVG icons and graphics to your website.
https://nickdiego.com/projects/icon-block/
GNU General Public License v2.0
104 stars 14 forks source link

A way to add classes to custom icon libraries #27

Open nick-novak opened 1 year ago

nick-novak commented 1 year ago

Hey, I think it would be great if when creating a custom icon to the block that certain icons or categories could have custom classes.

example { isDefault: true, name: 'bookmark', title: __( 'Bookmark', 'icon-block' ), icon: '<svg width="24px" height="24px" viewBox="0 0 24 24"><path d="M15.5,4.25 L9,4.25 C7.48121644,4.25 6.25,5.48121644 6.25,7 L6.25,19.5 L6.25678483,19.6039817 C6.33269168,20.17682 7.02861659,20.4632798 7.48809353,20.0694425 L12.25,15.988 L17.0119065,20.0694425 C17.4984115,20.4864467 18.25,20.1407649 18.25,19.5 L18.25,7 C18.25,5.48120782 17.0188049,4.25 15.5,4.25 Z M15.5,5.75 L15.6278083,5.75645347 C16.2581415,5.82046462 16.75,6.3527795 16.75,7 L16.75,17.869 L12.7380935,14.4305575 L12.63989,14.3592262 C12.3667749,14.1927863 12.0115663,14.2165634 11.7619065,14.4305575 L7.75,17.868 L7.75,7 C7.75,6.30964356 8.30964356,5.75 9,5.75 L15.5,5.75 Z"></path></svg>', categories: [ 'category-one', 'category-two' ], class: ['custom-class'] },

ndiego commented 1 year ago

Hey Nick, thanks for logging this issue. Do you imagine these classes would get added as "Additional CSS Classes" on icon insertion?

image

nick-novak commented 1 year ago

That would be fine in the editor. Easy enough and follows the similarities of WP.

In the example I gave it's more in the custom icon file. It might be nice to add them to icons like you do when you add categories to them.