PrestaShop / hummingbird

82 stars 76 forks source link

Find a way to be able to replace the icon library #205

Open mparvazi opened 2 years ago

mparvazi commented 2 years ago

We would love to provide a way to replace the current icon library

It isn't easy because:

Here are some ideas we found with the community on slack:

Archived

Bootstrap Icons designed for web apps and theme-refacto uses BS5. So why we should not use that?

We can keep material-icons support for modules, but using BS icons for theme.

https://github.com/twbs/icons

https://icons.getbootstrap.com/

IMO material-icons designed for mobile apps (specially Android).

SharakPL commented 2 years ago

Already proposed this and maintainers seemed enthusiastic, but so far the theme is made with material icons support

Hlavtox commented 2 years ago

The problem is that all modules count on material icons. :( We will need to think about a way to somehow make it work.

Otherwise, I like boostrap icons, they are a nice refresh from material and fontawesome, something new. 👍

NeOMakinG commented 2 years ago

Already proposed this and maintainers seemed enthusiastic, but so far the theme is made with material icons support

Because of what @Hlavtox said, we need to support material icons by default, but we can find a way to support multiple icons lib...

I asked the community about some things on slack, I'll add what we spoke about to this issue later

@Oksydan may be interested in this

SharakPL commented 2 years ago

IMO it would be better to use <symbol>s and svgs for icons instead of any icon font.

  1. Only needed icons, not whole icon font.
  2. Only 1 file for icons (tpl) instead of whole set (woff, woff2, etc.).
  3. Symbols are loaded by targeting ID so it's very easy to change icons for whole theme. No need to update class names in multiple files to switch to different icon font like it is now.
mparvazi commented 2 years ago

Font Awesome uses SVG sprites but Material Icons and Bootstrap Icons have one SVG file for each icon.

NeOMakinG commented 2 years ago

Yeah this is what I was thinking @SharakPL but if we do this, we break the display of every module using icons, I'm not sure that we want to add more difficulties for the moment and reduce the adoption of the theme :/

SharakPL commented 2 years ago

Breaks are inevitable and there won't be better moment for changes like this. All native modules should get new major version.

We could also make a module to handle compatibility with several old libraries including material icons, uislider, jquery, etc. When user is certain none of the modules and theme use these then it would be easy to just disable the library or uninstall the module completely.

NeOMakinG commented 2 years ago

Mmmh, this module could be a great idea, because icons lib is not the only one we don't rely on, jQuery for example could be included in this library too

SharakPL commented 2 years ago

Or it could even be a built-in functionality of Prestashop to handle all libraries in one place and avoid breaking changes like that in the future. Also we should be able to handle these resources in theme.yml, eg.

libraries:
  enable:
    - material-icons:"https://cdn.link"
  disable:
    - jquery

Presta would finally have a way to avoid loading the same library by multiple modules.

eveneme commented 10 months ago

The majority of large software applications use Font Awesome icons, and I would lean towards Font Awesome as well.

SharakPL commented 10 months ago

FA offers only solid versions for free. Breaking all the modules for that is rather pointless. I think we should switch to symbols and allow modules to use them or add new symbols. Otherwise stay with material icons.

Maybe we could use a function for this, eg. instead of <i class="material-icons home"></i> or <i class="material-icons">home</i> or <i class="fa-solid fa-home"></i> we could simply use {icon('home', '2em')} (name and optional size) in the templates and modules. Then icon font would be configurable and it wouldn't matter for any theme or module which font it uses because they would all use the same syntax.

That would probably require major changes throughout the project like making ps10 a new brand eg. PrestaShopX and use the occasion to get rid of all legacy compliance, maybe ditch Smarty for Vue on the front and make new modules eg. psx_mailalerts