Skip to content

Commit 9c06029

Browse files
committed
Update documentation and tests to change twig:ux:component to twig:UX:Component
1 parent a282ed5 commit 9c06029

File tree

8 files changed

+32
-32
lines changed

8 files changed

+32
-32
lines changed

src/Icons/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## 2.20.0
44

55
- Add `aliases` configuration option to define icon alternative names.
6-
- Add support for `int` and `float` attribute values in `<twig:ux:icon />`.
6+
- Add support for `int` and `float` attribute values in `<twig:UX:Icon />`.
77

88
## 2.19.0
99

src/Icons/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Renders local and remote [SVG icons](https://ux.symfony.com/icons) in your Twig
77
{{ ux_icon('mdi:check', {class: 'w-4 h-4'}) }}
88
99
{# .. or Twig Component #}
10-
<twig:ux:icon name="mdi:check" class="w-4 h-4" />
10+
<twig:UX:Icon name="mdi:check" class="w-4 h-4" />
1111
1212
{# Render the "check" icon from "mdi" pack with class #}
1313
<svg viewBox="0 0 24 24" fill="currentColor" class="w-4 h-4">

src/Icons/doc/index.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,20 @@ HTML Syntax
165165
~~~~~~~~~~~
166166

167167
In addition to the ``ux_icon()`` function explained in the previous sections,
168-
this package also supports an alternative HTML syntax based on the ``<twig:ux:icon>``
168+
this package also supports an alternative HTML syntax based on the ``<twig:UX:Icon>``
169169
tag:
170170

171171
.. code-block:: html
172172

173173
<!-- renders "user-profile.svg" -->
174-
<twig:ux:icon name="user-profile" class="w-4 h-4" />
174+
<twig:UX:Icon name="user-profile" class="w-4 h-4" />
175175
<!-- renders "admin/user-profile.svg" -->
176-
<twig:ux:icon name="admin:user-profile" class="w-4 h-4" />
176+
<twig:UX:Icon name="admin:user-profile" class="w-4 h-4" />
177177
<!-- renders 'user-solid.svg' icon from 'Flowbite' icon set via ux.symfony.com -->
178-
<twig:ux:icon name="flowbite:user-solid" />
178+
<twig:UX:Icon name="flowbite:user-solid" />
179179

180180
<!-- you can also add any HTML attributes -->
181-
<twig:ux:icon name="user-profile" height="16" width="16" aria-hidden="true" />
181+
<twig:UX:Icon name="user-profile" height="16" width="16" aria-hidden="true" />
182182

183183
.. tip::
184184

@@ -298,16 +298,16 @@ HTML Syntax
298298

299299
.. code-block:: html+twig
300300

301-
<twig:ux:icon name="user-profile" />
301+
<twig:UX:Icon name="user-profile" />
302302

303303
{# Renders "user-profile.svg" #}
304-
<twig:ux:icon name="user-profile" class="w-4 h-4" />
304+
<twig:UX:Icon name="user-profile" class="w-4 h-4" />
305305

306306
{# Renders "sub-dir/user-profile.svg" (sub-directory) #}
307-
<twig:ux:icon name="sub-dir:user-profile" class="w-4 h-4" />
307+
<twig:UX:Icon name="sub-dir:user-profile" class="w-4 h-4" />
308308

309309
{# Renders "flowbite:user-solid" from ux.symfony.com #}
310-
<twig:ux:icon name="flowbite:user-solid" />
310+
<twig:UX:Icon name="flowbite:user-solid" />
311311

312312
.. note::
313313

@@ -363,9 +363,9 @@ Now, you can use the ``dots`` alias in your templates:
363363
{{ ux_icon('clarity:ellipsis-horizontal-line') }}
364364

365365
{# using the HTML syntax #}
366-
<twig:ux:icon name="dots" />
366+
<twig:UX:Icon name="dots" />
367367
{# same as: #}
368-
<twig:ux:icon name="clarity:ellipsis-horizontal-line" />
368+
<twig:UX:Icon name="clarity:ellipsis-horizontal-line" />
369369

370370
Errors
371371
------
@@ -419,7 +419,7 @@ three methods to improve icons accessibility, depending on the context.
419419
Back to profile
420420
</a>
421421

422-
That is why the ``ux_icon()`` function and the ``<twig:ux:icon>`` component add
422+
That is why the ``ux_icon()`` function and the ``<twig:UX:Icon>`` component add
423423
``aria-hidden="true"`` attribute **automatically** to icons not having at least one
424424
of the following attributes: ``aria-label``, ``aria-labelledby`` or ``title``.
425425

@@ -430,7 +430,7 @@ of the following attributes: ``aria-label``, ``aria-labelledby`` or ``title``.
430430

431431
.. code-block:: html+twig
432432

433-
<twig:ux:icon name="user-profile" aria-hidden="false" />
433+
<twig:UX:Icon name="user-profile" aria-hidden="false" />
434434

435435
Performance
436436
-----------
@@ -461,7 +461,7 @@ In production, you can pre-warm the cache by running the following command:
461461
$ php bin/console ux:icons:warm-cache
462462
463463
This command looks in all your Twig templates for ``ux_icon()`` calls and
464-
``<twig:ux:icon>`` tags and caches the icons it finds.
464+
``<twig:UX:Icon>`` tags and caches the icons it finds.
465465

466466
.. caution::
467467

@@ -493,18 +493,18 @@ TwigComponent
493493
~~~~~~~~~~~~~
494494

495495
The ``ux_icon()`` function is optimized to be as fast as possible. To deliver the
496-
same level of performance when using the HTML syntax (``<twig:ux:icon name="..." />``),
496+
same level of performance when using the HTML syntax (``<twig:UX:Icon name="..." />``),
497497
the TwigComponent overhead is reduced by calling the IconRenderer immediately and
498498
returning the HTML output.
499499

500500
.. warning::
501501

502-
The <twig:ux:icon> component does not support embedded content.
502+
The <twig:UX:Icon> component does not support embedded content.
503503

504504
.. code-block:: html+twig
505505

506506
{# The 🧸 will be ignored in the HTML output #}
507-
<twig:ux:icon name="user-profile" class="w-4 h-4">🧸</twig:ux:icon>
507+
<twig:UX:Icon name="user-profile" class="w-4 h-4">🧸</twig:UX:Icon>
508508

509509
{# Renders "user-profile.svg" #}
510510
<svg viewBox="0 0 24 24" class="w-4 h-4">

src/Icons/tests/Integration/RenderIconsInTwigTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ public function testRenderIcons(): void
4343

4444
public function testRenderAliasIcons(): void
4545
{
46-
$templateIcon = '<twig:ux:icon name="flowbite:close-outline" />';
46+
$templateIcon = '<twig:UX:Icon name="flowbite:close-outline" />';
4747
$outputIcon = self::getContainer()->get(Environment::class)->createTemplate($templateIcon)->render();
4848

49-
$templateAlias = '<twig:ux:icon name="flowbite:x-outline" />';
49+
$templateAlias = '<twig:UX:Icon name="flowbite:x-outline" />';
5050
$outputAlias = self::getContainer()->get(Environment::class)->createTemplate($templateAlias)->render();
5151

5252
$expected = '<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L17.94 6M18 18L6.06 6"/></svg>';

src/Map/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
## 2.20
2323

2424
- Deprecate `render_map` Twig function (will be removed in 2.21). Use
25-
`ux_map` or the `<twig:ux:map />` Twig component instead.
25+
`ux_map` or the `<twig:UX:Map />` Twig component instead.
2626
- Add `ux_map` Twig function (replaces `render_map` with a more flexible
2727
interface)
28-
- Add `<twig:ux:map />` Twig component
28+
- Add `<twig:UX:Map />` Twig component
2929
- The importmap entry `@symfony/ux-map/abstract-map-controller` can be removed
3030
from your importmap, it is no longer needed.
3131
- Add `Polygon` support

src/Map/doc/index.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,14 @@ templates. The function accepts the same arguments as the ``Map`` class:
243243
}
244244
) }}
245245

246-
Twig Component ``<twig:ux:map />``
246+
Twig Component ``<twig:UX:Map />``
247247
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
248248

249-
Alternatively, you can use the ``<twig:ux:map />`` component.
249+
Alternatively, you can use the ``<twig:UX:Map />`` component.
250250

251251
.. code-block:: html+twig
252252

253-
<twig:ux:map
253+
<twig:UX:Map
254254
center="[51.5074, 0.1278]"
255255
zoom="3"
256256
markers='[
@@ -266,7 +266,7 @@ Alternatively, you can use the ``<twig:ux:map />`` component.
266266
style="height: 800px; width: 100%; border: 4px solid red; margin-block: 10vh;"
267267
/>
268268

269-
The ``<twig:ux:map />`` component requires the `Twig Component`_ package.
269+
The ``<twig:UX:Map />`` component requires the `Twig Component`_ package.
270270

271271
.. code-block:: terminal
272272

src/Map/tests/Twig/MapComponentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function testRenderMapComponent(): void
4040
self::getContainer()->set('test.ux_map.renderers', $renderer);
4141

4242
$twig = self::getContainer()->get('twig');
43-
$template = $twig->createTemplate('<twig:ux:map center="{{ {lat: 5, lng: 10} }}" zoom="4" data-foo="bar" />');
43+
$template = $twig->createTemplate('<twig:UX:Map center="{{ {lat: 5, lng: 10} }}" zoom="4" data-foo="bar" />');
4444

4545
$this->assertSame(
4646
'<div data-controller="@symfony/ux-foobar-map"></div>',

ux.symfony.com/cookbook/component_architecture.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ In Symfony, you can have an `Alert` component, for example, with the following t
3333

3434
```twig
3535
<div class="alert alert-{{ type }}">
36-
<twig:ux:icon name="{{ icon }}" />
36+
<twig:UX:Icon name="{{ icon }}" />
3737
{{ message }}
3838
</div>
3939
```
@@ -43,9 +43,9 @@ Or you can compose with the following syntax:
4343

4444
```twig
4545
<twig:Card>
46-
<twig:ux:icon name="info"/>
46+
<twig:UX:Icon name="info"/>
4747
<twig:Button>
48-
<twig:ux:icon name="close" />
48+
<twig:UX:Icon name="close" />
4949
</twig:Button>
5050
</twig:Card>
5151
```
@@ -79,7 +79,7 @@ We have the following template:
7979
{% props type, icon, message %}
8080
8181
<div class="alert alert-{{ type }}">
82-
<twig:ux:icon name="{{ icon }}" />
82+
<twig:UX:Icon name="{{ icon }}" />
8383
{{ message }}
8484
</div>
8585
```

0 commit comments

Comments
 (0)