Skip to content

Commit d3000fb

Browse files
committed
[Site] Complete migration to UX Icons
1 parent 781f66c commit d3000fb

33 files changed

+101
-70
lines changed

ux.symfony.com/cookbook/component_architecture.md

+4-4
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: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:Icon name="info"/>
46+
<twig:ux:icon name="info"/>
4747
<twig:Button>
48-
<twig: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:Icon name="{{ icon }}" />
82+
<twig:ux:icon name="{{ icon }}" />
8383
{{ message }}
8484
</div>
8585
```
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace App\UX;
13+
14+
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;
15+
use Symfony\Component\DependencyInjection\Attribute\AutowireDecorated;
16+
use Symfony\UX\Icons\IconRendererInterface;
17+
18+
#[AsDecorator(decorates: '.ux_icons.icon_renderer')]
19+
class IconRenderer implements IconRendererInterface
20+
{
21+
public function __construct(
22+
#[AutowireDecorated]
23+
private IconRendererInterface $inner,
24+
) {
25+
}
26+
27+
public function renderIcon(string $name, array $attributes = []): string
28+
{
29+
return $this->inner->renderIcon($name, [
30+
...$attributes,
31+
'class' => \sprintf('%s %s', 'Icon', $attributes['class'] ?? ''),
32+
]);
33+
}
34+
}

ux.symfony.com/templates/_banner.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</div>
99
<div class="BannerAction">
1010
<a href="https://gofund.me/44ecdba2" class="BannerButton" rel="external">
11-
<twig:Icon name="heart" aria-hidden="true"/>
11+
<twig:ux:icon name="heart" aria-hidden="true"/>
1212
Donate
1313
</a>
1414
</div>

ux.symfony.com/templates/_footer.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
aria-label="Symfony UX on GitHub"
99
class="order-lg-1"
1010
>
11-
<twig:Icon name="github"/>
11+
<twig:ux:icon name="github"/>
1212
</a>
1313
<a href="{{ url('app_documentation') }}" style="font-size: 11px; text-transform: uppercase;" class="order-lg-0">Docs</a>
1414
<a href="{{ url('app_changelog') }}" style="font-size: 11px; text-transform: uppercase;" class="order-lg-0">Changelog</a>
@@ -17,7 +17,7 @@
1717
style="font-size: 1.5rem;"
1818
aria-label="Symfony website"
1919
>
20-
<twig:Icon name="symfony"/>
20+
<twig:ux:icon name="symfony"/>
2121
</a>
2222
</p>
2323
</div>

ux.symfony.com/templates/_header.html.twig

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
data-action="ux-header#toggleMenu"
1414
aria-label="Toggle menu"
1515
>
16-
<twig:Icon name="menu"/>
16+
<twig:ux:icon name="menu"/>
1717
</button>
1818
<twig:ThemeSwitcher class="AppNav_item AppNav_item--icon" aria-label="Switch dark/light mode"/>
1919
<a
@@ -22,15 +22,15 @@
2222
rel="external me"
2323
title="Symfony UX on X (Twitter)"
2424
>
25-
<twig:Icon name="x-twitter"/>
25+
<twig:ux:icon name="x-twitter"/>
2626
</a>
2727
<a
2828
class="AppNav_item AppNav_item--icon d-none d-sm-grid"
2929
href="https://github.com/symfony/ux"
3030
rel="external me"
3131
title="Symfony UX on GitHub"
3232
>
33-
<twig:Icon name="github" />
33+
<twig:ux:icon name="github" />
3434
</a>
3535
</div>
3636

ux.symfony.com/templates/components/Browser.html.twig

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@
1515
</button>
1616
</div>
1717
<div class="Browser__url">
18-
<twig:Icon name="lock" />
18+
<twig:ux:icon name="lock" />
1919
<span>
2020
<span hidden>https://</span><em>ux.symfony.com</em><span hidden>{{ url }}</span>
2121
</span>
2222
<button class="Browser__action">
23-
<twig:Icon name="refresh" />
23+
<twig:ux:icon name="refresh" />
2424
</button>
2525
</div>
2626
<div class="Browser__actions">
2727
{% if false %}
2828
<button class="Browser__action" data-bs-toggle="tooltip" title="Feedback">
29-
<twig:Icon name="circle-help" />
29+
<twig:ux:icon name="circle-help" />
3030
</button>
3131
{% endif %}
3232
{% if githubUrl|default %}
3333
<a class="Browser__action" data-bs-toggle="tooltip" title="View on Github" href="{{ githubUrl }}">
34-
<twig:Icon name="github" />
34+
<twig:ux:icon name="github" />
3535
</a>
3636
{% endif %}
3737
</div>

ux.symfony.com/templates/components/ChangelogItem.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<details {{ isOpen|default ? 'open' }}>
1515
<summary class="ChangelogItem__Head">
1616
<h2 class="ChangelogItem__Title">{{ item.name|default(item.version) }}</h2>
17-
<twig:Icon name="arrow-down" class="ChangelogItem__Toggle" />
17+
<twig:ux:icon name="arrow-down" class="ChangelogItem__Toggle" />
1818
</summary>
1919
<div class="ChangelogItem__Text">
2020
{{ this.getContent()|markdown_to_html }}

ux.symfony.com/templates/components/Code/CodeBlock.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
data-code-expander-target="expandCodeButton"
4747
data-action="code-expander#expandCode"
4848
>
49-
<twig:Icon name="arrow-down"/>
49+
<twig:ux:icon name="arrow-down"/>
5050
<span>Expand code</span>
5151
</button>
5252
{% endblock %}

ux.symfony.com/templates/components/Code/CodeBlockButtons.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
data-bs-placement="bottom"
1212
title="View on GitHub"
1313
>
14-
<twig:Icon name="github"/>
14+
<twig:ux:icon name="github"/>
1515
</a>
1616
{% endset %}
1717

@@ -32,7 +32,7 @@
3232
data-action="clipboarder#copy"
3333
data-clipboarder-target="button"
3434
>
35-
<twig:Icon name="copy"/>
35+
<twig:ux:icon name="copy"/>
3636
</button>
3737
</div>
3838

ux.symfony.com/templates/components/Code/CodeLine.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
><code>{{ _code ? _code|trim|raw : code }}</code></pre>
1717

1818
<button class="btn btn-sm IconModalcopy" data-action="clipboarder#copy" data-clipboarder-target="button">
19-
<twig:Icon name="copy" />
19+
<twig:ux:icon name="copy" />
2020
</button>
2121
</div>

ux.symfony.com/templates/components/DocsLink.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
rel="{{ isExternal ? 'external noopened noreferrer' }}"
66
>{{ title }}</a>
77
{% if icon|default %}
8-
<twig:Icon name="{{ icon }}" class="DocsLink_arrow"/>
8+
<twig:ux:icon name="{{ icon }}" class="DocsLink_arrow"/>
99
{% elseif isExternal %}
10-
<twig:Icon name="arrow-right" style="transform: rotate(-45deg);" class="DocsLink_arrow"/>
10+
<twig:ux:icon name="arrow-right" style="transform: rotate(-45deg);" class="DocsLink_arrow"/>
1111
{% endif %}
1212
</p>
1313
<div class="DocsLink_description">

ux.symfony.com/templates/components/FoodVote.html.twig

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<td style="width: 250px;">
77
{% if hasVoted %}
88
<div class="alert alert-success">
9-
Thanks for voting! <twig:Icon name="circle-check" />
9+
Thanks for voting! <twig:ux:icon name="circle-check" />
1010
</div>
1111
{% else %}
1212
<button
@@ -16,7 +16,7 @@
1616
data-live-action-param="vote"
1717
data-live-direction-param="up"
1818
>
19-
<twig:Icon name="arrow-up" />
19+
<twig:ux:icon name="arrow-up" />
2020
</button>
2121
<button
2222
type="button"
@@ -25,7 +25,7 @@
2525
data-live-action-param="vote"
2626
data-live-direction-param="down"
2727
>
28-
<twig:Icon name="arrow-down" />
28+
<twig:ux:icon name="arrow-down" />
2929
</button>
3030
{% endif %}
3131
</td>

ux.symfony.com/templates/components/Icon.html.twig

-7
This file was deleted.

ux.symfony.com/templates/components/Icon/IconModal.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<span>{{ icon.prefix }}</span><span>:</span><span>{{ icon.name }}</span>
2222
</p>
2323
<button type="button" class="btn close" data-action="icon-modal#close">
24-
<twig:Icon name="cross"/>
24+
<twig:ux:icon name="cross"/>
2525
</button>
2626
</div>
2727

ux.symfony.com/templates/components/Icon/IconSearch.html.twig

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<div class="input-group" style="max-width: 200px;">
99
<label class="input-group-text" for="IconSearch-Set">
10-
<twig:Icon name="icon-sets"/>
10+
<twig:ux:icon name="icon-sets"/>
1111
</label>
1212
<select class="form-control" data-model="set" id="IconSearch-Set">
1313
<option value="">All sets</option>
@@ -23,7 +23,7 @@
2323

2424
<div class="input-group IconSearch__Query">
2525
<label class="input-group-text" for="IconSearch-Query">
26-
<twig:Icon name="icon-search"/>
26+
<twig:ux:icon name="icon-search"/>
2727
</label>
2828
<input
2929
autofocus
@@ -41,18 +41,18 @@
4141
<div class="d-flex flex-shrink-0 IconSearch__Display">
4242
<div class="btn-group" role="group" data-controller="icon-size">
4343
<button class="btn" data-action="icon-size#small">
44-
<twig:Icon name="grid-small"/>
44+
<twig:ux:icon name="grid-small"/>
4545
</button>
4646
<button class="btn" data-action="icon-size#large">
47-
<twig:Icon name="grid-large"/>
47+
<twig:ux:icon name="grid-large"/>
4848
</button>
4949
</div>
5050
</div>
5151

5252
{% if false %}
5353
<div data-live-ignore="true">
5454
<button class="btn IconBag__Button" data-controller="icon-bag">
55-
<twig:Icon name="icon-folder"/>
55+
<twig:ux:icon name="icon-folder"/>
5656
<span class="IconBag__Badge" data-icon-bag-target="count"></span>
5757
</button>
5858
</div>

ux.symfony.com/templates/components/InlineEditFood.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
class="btn btn-link"
4242
title="Click to edit!"
4343
>
44-
<twig:Icon name="pencil" />
44+
<twig:ux:icon name="pencil" />
4545
</button>
4646
{% endif %}
4747
</div>

ux.symfony.com/templates/components/InvoiceCreator.html.twig

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
data-live-action-param="addLineItem"
6060
class="btn btn-sm btn-secondary"
6161
type="button"
62-
><twig:Icon name="plus" /> Add Item</button>
62+
><twig:ux:icon name="plus" /> Add Item</button>
6363
</div>
6464
</div>
6565

@@ -101,13 +101,13 @@
101101
{{ areAnyLineItemsEditing ? 'disabled' : '' }}
102102
>
103103
<span data-loading="action(saveInvoice)|show">
104-
<twig:Icon name="spinner" style="animation: spin 1s linear infinite;" />
104+
<twig:ux:icon name="spinner" style="animation: spin 1s linear infinite;" />
105105
</span>
106106
{% if savedSuccessfully %}
107-
<twig:Icon name="circle-check" class="text-success" />
107+
<twig:ux:icon name="circle-check" class="text-success" />
108108
{% endif %}
109109
{% if saveFailed %}
110-
<twig:Icon name="circle-exclamation" />
110+
<twig:ux:icon name="circle-exclamation" />
111111
{% endif %}
112112
Save Invoice
113113
</button>

ux.symfony.com/templates/components/InvoiceCreatorLineItem.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@
7373
data-live-key-param="{{ key }}"
7474
class="btn btn-link text-danger btn-sm ml-2"
7575
type="button"
76-
><twig:Icon name="cross" /></button>
76+
><twig:ux:icon name="cross" /></button>
7777
</td>
7878
</tr>

ux.symfony.com/templates/components/Package/PackageBox.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<{{ titleTag }} class="PackageBox_title">
1010
<a href="{{ path(package.route) }}" class="PackageBox_link">{{ package.humanName }}</a>
1111
<span class="PackageBox_arrow">
12-
<twig:Icon name="arrow-right" />
12+
<twig:ux:icon name="arrow-right" />
1313
</span>
1414
</{{ titleTag }}>
1515
<div class="PackageBox_description">

ux.symfony.com/templates/components/TerminalCommand.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
aria-label="Copy command"
1313
data-action="clipboarder#copy"
1414
>
15-
<twig:Icon name="copy"/>
15+
<twig:ux:icon name="copy"/>
1616
</button>
1717
</div>

ux.symfony.com/templates/components/ThemeSwitcher.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
data-controller="theme-switcher"
66
data-action="theme-switcher#switch"
77
>
8-
<twig:Icon name="theme-light" />
9-
<twig:Icon name="theme-dark" />
8+
<twig:ux:icon name="theme-light" class="Icon--theme-light" />
9+
<twig:ux:icon name="theme-dark" class="Icon--theme-dark" />
1010
</button>

ux.symfony.com/templates/demos/live_memory/components/LiveMemory/ThemeSwitch.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
data-action="theme-switcher#switch"
88
>
99
<span class="LiveMemory-ThemeSwitch-Mode LiveMemory-ThemeSwitch-Dark" data-theme="dark">
10-
<twig:Icon name="theme-dark" />
10+
<twig:ux:icon name="theme-dark" />
1111
</span>
1212
<span class="LiveMemory-ThemeSwitch-Mode LiveMemory-ThemeSwitch-Light" data-theme="light">
13-
<twig:Icon name="theme-light" />
13+
<twig:ux:icon name="theme-light" />
1414
</span>
1515
</button>

ux.symfony.com/templates/demos/live_memory/index.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<header class="Header">
1717
<nav class="HeaderMenu">
1818
<a href="{{ url('app_demos') }}" class="HeaderButton" aria-label="Back to the demos">
19-
<twig:Icon name="arrow-left" />
19+
<twig:ux:icon name="arrow-left" />
2020
<span aria-hidden="true" hidden>Back to the demos</span>
2121
</a>
2222
</nav>

ux.symfony.com/templates/main/_file_tree.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{% if file_info.isDirectory %}
99
<li class="FileTree-main FileTree-dir">
1010
<span {{- _self.summaryAttributes(file_info.description) -}}>
11-
<twig:Icon name="folder-open" class="d-inline-block m-0 mr-2"/>
11+
<twig:ux:icon name="folder-open" class="d-inline-block m-0 mr-2"/>
1212
{{ file_info.filename }}
1313
</span>
1414

@@ -21,7 +21,7 @@
2121
{% else %}
2222
<li class="FileTree-main FileTree-file">
2323
<span {{- _self.summaryAttributes(file_info.description) -}}>
24-
<twig:Icon name="file" class="d-inline-block m-0 mr-2" />
24+
<twig:ux:icon name="file" class="d-inline-block m-0 mr-2" />
2525
{{ file_info.filename }}
2626
</span>
2727
</li>

0 commit comments

Comments
 (0)