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

feat(icon): Webtools icons - FRONT-4688 #3736

Open
wants to merge 18 commits into
base: v4-dev
Choose a base branch
from
Open

Conversation

emeryro
Copy link
Contributor

@emeryro emeryro commented Nov 26, 2024

Add possibility to use Webtools icons instead of the ones provided directly by ECL

Main ideas:

  • icon template has a new parameter wt_markup. Setting it to true would render the webtools markup, later replaced by the icon via Webtools javascript
  • components using icons have a new parameter in twig template: icon_wt_markup. This had to be done at component level, as some icon are handled directly here, and do not expose the full icon structure

Copy link

github-actions bot commented Nov 26, 2024

@github-actions github-actions bot temporarily deployed to pull request November 26, 2024 08:19 Inactive
@github-actions github-actions bot temporarily deployed to pull request November 26, 2024 08:28 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 6, 2024 10:41 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 9, 2024 13:42 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 12, 2024 15:12 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 19, 2024 10:43 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 20, 2024 12:21 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 6, 2025 07:20 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 6, 2025 09:33 Inactive
@emeryro emeryro changed the title feat(icon): PoC WT icons - FRONT-4688 feat(icon): Webtools icons - FRONT-4688 Jan 7, 2025
@github-actions github-actions bot temporarily deployed to pull request January 7, 2025 08:53 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 7, 2025 13:42 Inactive
Copy link
Collaborator

@planctus planctus left a comment

Choose a reason for hiding this comment

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

I think we don't need to expose a parameter in each component using icons, it's a lot of code and logic to handle something that should belong to the icon, not to the component implementing it. Also, if the intention is to always use the other icons, then it would be just a matter of toggling the value of the parameter in the icon template and all these additional parameters would become obsolete and useless.

@@ -15,6 +15,7 @@ npm install --save @ecl/twig-component-accordion
- "label" (string) (default: '')
- "content" (string) (default: '')
- **"icon"** (array) OR (object) (default: []) Two icons in an array that will be toggled
- **"icon_wt_markup"** (boolean) (default: false): should the icon use the Webtools markup?
Copy link
Collaborator

Choose a reason for hiding this comment

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

it's a boolean but it mentions markup in its name, feels confusing, anyway do we need it at all? I understand that in certain components we might be defining the icons ourselves, and there we need somehow to add a param to handle this, but here and in many other components we could simply use the param as part of the icon object passed. Also, it might not really be a real use case, but if i want to use one icon only from webtools in components that have multiple it would not be possible this way.

@@ -65,7 +72,7 @@
{% endif %}

{% for property in ['size', 'transform', 'color'] %}
{% if _icon[property] is defined and _icon[property] is not empty %}
{% if _icon[property] is defined and _icon[property] is not empty and _icon[property] != 'none' %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this additional check needed because of the storybook demo..?

{% set _wt_classes = '' %}
{% set _full_name = '' %}
{% if _icon.category is not empty %}
{% set _full_name = _full_name ~ '-' ~ _icon.category %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is weird, _full_name is an empty string, guess that it can simply get _icon_category as its value when its present.

@@ -19,25 +19,36 @@ const getArgs = (data) => ({
color: 'default',
transform: 'none',
title: '',
description: '',
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure about the whole plan regarding this, but shouldn't we expose a control to demo this?

@@ -77,10 +79,11 @@
{% set _link = _link|merge(link) %}
{% endif %}

{% if _link.external and _link.icon_path is not empty %}
{% if _link.external and (_link.icon_path is not empty or _link.icon_wt_markup) %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is one of those cases where i don't understand why adding the parameter at the component level, we merge the data provided by the user, why do we need to add this complexity and additional processing with also the consequence of forcing all the icons to follow the same approach?

@github-actions github-actions bot temporarily deployed to pull request January 8, 2025 13:12 Inactive
@emeryro
Copy link
Contributor Author

emeryro commented Jan 9, 2025

I'll check the different points, but to address your main concern:
Initially I tried to put the parameter only in the icon, and in a few components where it was needed, but even on my side it became hard to know where to put the boolean in the data. So I decided to expose it at component level every time.
I agree that it may be a little too much, but at least this is consistent (and would probably save some back and forth with EWPP, or the need for a dedicated documentation)

@emeryro emeryro marked this pull request as ready for review January 9, 2025 09:18
@github-actions github-actions bot temporarily deployed to pull request January 9, 2025 09:26 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants