- Issue created by @pdureau
- 🇫🇷France just_like_good_vibes PARIS
i will take it.
@pdureau, do you suggest that we should wait before adopting ui_icons?like waiting for the core MR to be merged or waiting for a stable version of ui_icons module?
- 🇫🇷France pdureau Paris
@pdureau, do you suggest that we should wait before adopting ui_icons?
It is a breaking change for UI Suite DSFR, so we need to do it for 1.1.0, not later. We will not introduce breaking changes in patch releases (1.1.1, 1.1.2, 1.1.3....).
Today, the
icon
prop type and its related source plugin are found in this module: https://git.drupalcode.org/project/ui_icons/-/tree/1.0.x/modules/ui_icon.... But it will move in https://git.drupalcode.org/project/ui_patterns/-/tree/2.0.x/src/Plugin/U... as soon as ✨ Add an icon management API Active is merged.The plugin ID will not change, it will stay
icon
, so we can start with https://git.drupalcode.org/project/ui_icons/-/tree/1.0.x/modules/ui_icon... (let's not forget the temporary dependency) - 🇫🇷France pdureau Paris
we also need to remove the corresponding style utility (in
ui_suite_dsfr.ui_styles.yml
) ? And what about the related icon size utility? - 🇫🇷France pdureau Paris
Just a little side note before the review: I believe it is not necessary to put the empty setting value in stories:
type: icon icon_pack: dsfr settings: {}
Also, the empty valus is not compliant with our linter prettier:
- settings: { } + settings: {}
- 🇫🇷France pdureau Paris
So, the actual review.
---------------------
Careful, to follow the changes from ✨ Add an icon management API Active , the icon prop type structure has changed, from:
'icon_pack' => ['$ref' => 'ui-patterns://identifier'], 'icon' => ['type' => 'string'], 'settings' => ['type' => 'object'],
to:
'pack_id' => ['$ref' => 'ui-patterns://identifier'], 'icon_id' => ['type' => 'string'], 'settings' => ['type' => 'object'],
https://git.drupalcode.org/project/ui_icons/-/commit/87e8ed2b5962a21fe58...
-------------
You have set 3 icon packs:
dsfr
, using SVG extractor and printing a SVG elementdsfr_picto
, using SVG extractor and printing a SVG element- and
dsfr_name
(disabled), using SVG extractor and printing a SPAN element, with the same icons asdsfr
!
So, code>dsfr_picto is OK but you need to chose between
dsfr
&dsfr_name
because they are the same set of icons with different rendering.When someone will use the
icon
prop type in a component, they will have to pick an icon from one of the packs, and they will have a settings form to fill, what they set in the form need to have an impact on what happen in the template:- If you decide to keep using the icons like that in the template:
attributes.addClass('fr-icon-' ~ icon.icon)
I would chose to keepdsfr_name
(which can be renameddsfr
) because its settings can be used of the template, but the settings of the actualdsfr
(size
,color
andalt
) can't be used. - For
dsfr_picto
it is more complicated because the SVG element is the only way of rendering this icon pack according to upstream documentation, so we need a way to exclude code>dsfr_picto from the prop source.
I assigned to you for the
dsfr_name
&dsfr
change, but for thedsfr_picto
we will need to fo this first: ✨ Use #allowed_icon_pack with UI Patterns 2 Active-------------------------
Other little feedbacks:
- You kept the icon style utility?
- You don't need the dependency to
ui_icons:ui_icons
if you have a dependency toui_icons:ui_icons_patterns
- The icon packs descriptions are not very clear. Maybe you can copy and translate the descriptions form upstream documentation.
- 🇫🇷France just_like_good_vibes PARIS
thanks for all the precious feedbacks.
after a few tries, i may have figured it out.
- 🇫🇷France just_like_good_vibes PARIS
i just rebased.
i forgot yesterday to indicate the status "needs review".
Pierre, would you please review?Ideally, we will require ui_icons 1.0-beta3 as a minimal version (to be published in a few days)
- 🇫🇷France pdureau Paris
Currently reviewing.
First feedbacks..
you don't need to put settings in stories each time:
detail_icon: type: icon pack_id: dsfr settings: { } icon_id: file-pdf-line
this snippet is OK and repeated many times:
{% if icon.icon_id %} {% set attributes = attributes.addClass([icon.icon_id ? 'fr-icon-' ~ icon.icon_id|clean_class, (icon.settings.size|default('md') != 'md') ? 'fr-icon--' ~ icon.settings.size|clean_class, icon.settings.color ? 'fr-text-' ~ icon.settings.color|clean_class]) %} {% endif %}
{% set detail_end_attributes = detail_end_attributes.addClass(['fr-card__detail', detail_end_icon.icon_id ? 'fr-icon-' ~ detail_end_icon.icon_id|clean_class, (detail_end_icon.settings.size|default('md') != 'md') ? 'fr-icon--' ~ detail_end_icon.settings.size|clean_class]) %} <div{{ detail_end_attributes }}>{{ detail_end }}</div>
{% if not dismissible and icon.icon_id %} {% set attributes = attributes.addClass([icon.icon_id ? 'fr-icon-' ~ icon.icon_id|clean_class, (icon.settings.size|default('md') != 'md') ? 'fr-icon--' ~ icon.settings.size|clean_class, icon.settings.color ? 'fr-text-' ~ icon.settings.color|clean_class]).addClass('fr-tag--icon-left') %} {% endif %}
Let's see if we can make this more redable...
You chose to put the icon packs in
/libraries/
. Maybe it can be explained in a README.md (or similar) file. - 🇫🇷France just_like_good_vibes PARIS
The position of the library in /libraries/ is already enforced :)
see file
ui_suite_dsfr.libraries.yml
-
just_like_good_vibes →
committed 27700c08 on 1.1.x
Issue #3484134 by just_like_good_vibes, pdureau: ⚠️ Adopts the new Icon...
-
just_like_good_vibes →
committed 27700c08 on 1.1.x