-
-
Notifications
You must be signed in to change notification settings - Fork 361
[Icons] Docs: Merging HTML and Twig syntaxes #2795
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
base: 2.x
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UX Icons is a bundle that does not require Twig Component.
You suggestion here will delete/remove vital documentation about basic usage of this bundle.
This is not something anyone would benefit. And I must admit I'm not sure to understand your point / end goal on these recent PR.
I highly value the contributions you make on Symfony, and even more the ones you do on Symfony UX. Here, i don't see the positive / solution-oriented mindset I usually see in your work... is there anything I missread here ? Or anything we could discuss to clear any missunderstandings ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about having a single, top level "HTML Syntax" section, where this is the only place we talk about/show examples of it?
|
||
``symfony/ux-twig-component`` is required to use the HTML syntax. | ||
|
||
Default Attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer we keep this section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I shortened it to one sentence here:
Line 92 in b954ff7
You can set default attributes for all icons in your `Configuration`_. |
Together with the explanation in the config section at https://symfony.com/bundles/ux-icons/current/index.html#full-configuration I think it's clear how this works.
Which part would you say is important to keep?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the clear example. A single sentence would get lost.
I guess I'm not understanding your motivation here. Why are you suggesting removing this section but not Icon Aliases below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A single sentence would get lost.
Well, yes and no. I you merge everything I'm suggesting, then the page is only half as long ;-)
And if you start expanding the not-so-important parts (like this one), you need to expand/repeat the real important parts too...
And it's still shown twice: In the text, and in the config codeblock.
Why are you suggesting removing this section but not Icon Aliases below?
Mainly cause I haven't looked into it ;-)
And cause I don't understand that feature - so I thought I'd better not touch it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the shortest documentation a goal we have?
Configuring default attributes is a question we had a lot of times, so dedicating some example was decided. It's not only luck or randomness that did drive every choice here 😅
Indeed, that's explained at Line 66 in b954ff7
I know that reviewing docs changes on GitHub is a nightmare :-)
My main goal is to explain stuff just once and not three times :-) |
Yeah, I thought about that too. But if you want, I can split them. This would make comparing the syntaxes harder. But later on (after people have decided for one), give them a nicer "reference". |
I'm thinking of it in terms of "directing someone to the html syntax" - what section do I sent them to currently? @smnandre wdyt? |
You mean for reference on the HTML syntax? I'd say just here: Line 59 in b954ff7
Or do you mean "directing" them to switch to HTML syntax? (i.e. recommending it) IMO, the entire syntax is so easy/lightweight, that after having written it 2-3 times, people won't need much reference anymore. |
I think mixing syntaxes throughout the docs might be confusing. Better to show a consistent syntax, then "btw, you can use this alternate syntax" |
Uhm, there is no "throughout" anymore. The (almost) only other place with syntax is https://symfony.com/bundles/ux-icons/current/index.html#icon-aliases - which you just "urged" me to remove too (see #2795 (comment) :-) |
{# Includes the contents of 'assets/icons/user-profile.svg' in the template: #} | ||
{{ ux_icon('user-profile') }} | ||
{# Same in alternative HTML syntax: #} | ||
<twig:ux:icon name="user-profile" /> | ||
|
||
{{ ux_icon('user-profile', {height: '16px', width: '16px', 'aria-hidden': true}) }} | ||
{# renders <svg height="16" width="16" aria-hidden="true"> ... </svg> #} | ||
{# Includes 'assets/icons/admin/user-profile.svg': #} | ||
{{ ux_icon('admin:user-profile') }} | ||
<twig:ux:icon name="admin:user-profile" /> | ||
|
||
{# Adding a CSS class or other attribute to the `<svg>` element: #} | ||
{{ ux_icon('user-profile', {class: 'w-4', 'aria-hidden': 'true' }) }} | ||
<twig:ux:icon name="user-profile" class="w-4" aria-hidden="true" /> | ||
|
||
{# Download the 'user-solid.svg' icon from the 'Flowbite' icon set via ux.symfony.com: #} | ||
{{ ux_icon('flowbite:user-solid') }} | ||
<twig:ux:icon name="flowbite:user-solid" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for not mixing them like this is that some users might be confused about which syntax to use, and whether the HTML shown is the generated output
I really don’t think mixing the syntaxes in the first paragraph is a good idea: it doesn’t help clarify anything or solve any actual problem.
|
||
The ``ux_icon()`` function defines a second optional argument where you can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For both the Twig function and the HTML syntax, I think better to explain the first argument properly before jumping into customization.
It follows UX* rules: start simple, then show how to tweak things.. That way, users arent overwhelmed and can follow along more easily.
So I'd move back the CSS / height / etc. examples after the Flowbite one.
- the science field, not the repository^^
I see that you have strong opinions. So just take what you think is useful, and close/delete the rest. |
We're always open to improvements Recent suggestions felt a bit mixed --some very valid points, others less aligned with concrete user needs or going against points we've already covered. Thanks again for your time and input! |
https://symfony.com/bundles/ux-icons/current/index.html
symfony/ux-twig-component
was explained three times.