Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate Fontawesome icons #552

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

maxmarkus
Copy link
Contributor

@maxmarkus maxmarkus commented Mar 13, 2023

I picked up an older issue since I am not happy with the colorful icons.
This PR would be a replacement for the old icons to use fontawesome.

How it looks:
lansuite-icon-proposal

Negation was not straight forward so there is a second method, alternatively we could go with a different colorset for negation (paid / not paid, checked in or out / not checked in or our)

Not sure which way to go - support the old and new way, then we would need to add a wrapper to provide two icon names.

My proposal would be full replacement as a startingpoint for discussions.

Resolves #346

@sonarcloud
Copy link

sonarcloud bot commented Mar 13, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 32 Code Smells

No Coverage information No Coverage information
7.4% 7.4% Duplication

@M4LuZ
Copy link
Collaborator

M4LuZ commented Mar 14, 2023

My personal opinion - up for discussion - is that it would be better to have the icon set as user-selectable option and support both (or even additional icons).
While I also do like the FA set, somebody else may want something either the original icon set or something else altogether.

Rough Idea:

  • Completely standardise icon-names, so we have a mapping for all used icons
  • maybe use derived classes to switch what is used without a ton of branch statements? (also with the option to refer to parent:: if there is no matching icon)

$iconName = 'chevron-right';
break;
case 'preview':
$picname = 'magnifying-glass';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should also be $iconName, right?

@maxmarkus
Copy link
Contributor Author

After I filed the PR I also thought that it might be rude to remove the old icons completely, since other designs might depend on it. Also, FA is only included in solid style which is free, regular seems not to have all icons and also the Pro styles could be used by someone.

I like the idea of a generic class that holds the icon mapping, which could be designed extensible so people could bring their own icon font to map it to icons based on the mapping the class provides.

One thing that is clearly different between original icons and fontawesome and this is the possibility to stack icons (eg for negation or creating custom icon styles (eg all icons are square with rounded corners and have the icon to be cut out, fontawesome.com/v5/docs/web/style/stack)

How would we treat new icons that are used in custom designs or modules, just by calling the icon method and if it does not get found in the mapping, it's passed through.
Default setting as configuration?
Provide an override which icon set to use?
Can there be a mix and match between different icon sets (looks ugly maybe)? That would open the possibility to use fontawesome and bring in custom icons that are not provided by FA but could be designed similar.

So many questions to answer, quite some api contracts to define :-D

@M4LuZ
Copy link
Collaborator

M4LuZ commented Mar 15, 2023

  • Stacking: How about either extending the parameter $iconName? to handle arrays to support stacked icons or (what I would consider a better approach) define an additional method that sets a default set stored in an additional attribute to be always applied below whatever is then being passed during the concrete call? This would also work nicely with the approach of deriving this in a child class.
    e.g. add function $dsp->SetDefaultStack($stack).
    Orrrr...just throw it into an additional config parameter along with the icon design ;)
  • Passthrough: Could be quite simple, unless I miss something: We throw the icons in a switch-case and default just calls::parent->fetchIcon() that then returns whatever does exist by default (and maybe logs that there is an icon mapping missing. Either by default or just in debug mode)
    If you want to mix and match then it should also not be a huge deal to define the class to use as fallback separately.
    We would then refer to the parent class as default value and replace that if needed

@maxmarkus
Copy link
Contributor Author

Yep that sounds like a good plan. Unfortunately I got quite some things on my todo list already and those icons are not my highest prio for the next time. We can also close this PR and move the information to an issue, so anybody could work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Änderung von Icons
2 participants