File tree Expand file tree Collapse file tree 3 files changed +17
-27
lines changed Expand file tree Collapse file tree 3 files changed +17
-27
lines changed Original file line number Diff line number Diff line change 1111
1212namespace App \Twig ;
1313
14- use App \Service \UxPackageRepository ;
1514use Symfony \UX \TwigComponent \Attribute \AsTwigComponent ;
1615
1716#[AsTwigComponent]
@@ -20,20 +19,11 @@ class Alert
2019 public string $ type = 'success ' ;
2120 public string $ message ;
2221
23- public function __construct (private UxPackageRepository $ packageRepository )
24- {
25- }
26-
2722 public function getIcon (): string
2823 {
2924 return match ($ this ->type ) {
30- 'success ' => 'circle- check ' ,
31- 'danger ' => 'circle- exclamation ' ,
25+ 'success ' => 'bi: check-circle ' ,
26+ 'danger ' => 'bi: exclamation-circle ' ,
3227 };
3328 }
34-
35- public function getPackageCount (): int
36- {
37- return $ this ->packageRepository ->count ();
38- }
3929}
Original file line number Diff line number Diff line change 11<div class =" alert alert-{{ type }} alert-dismissible" role =" alert" >
2- <twig:Icon name =" {{ this .icon }}" class =" me-2 " />
2+ <twig:ux:icon name =" {{ this .icon }}" class =" Icon bi " />
33 {{ message }}
44</div >
Original file line number Diff line number Diff line change 2626{% block demo_title %}UX Twig Components{% endblock %}
2727
2828{% block demo_content %}
29- <div class =" row align-items-center" >
30- <div class =" col-6" >
31- {% block alert_success_example %}
32- <twig:Alert message =" I am a success alert!" />
33- {% endblock %}
34- </div >
29+ <div class =" row" >
3530 <div class =" col-6" >
3631 <twig:CodeBlock
3732 filename =" templates/ux_packages/twig_component.html.twig"
4136 height =" auto"
4237 />
4338 </div >
44- </div >
45-
46- <div class =" row my-2 align-items-center" >
4739 <div class =" col-6" >
48- {% block alert_danger_example %}
49- <twig:Alert
50- type =" danger"
51- message =" Oh no! The dinos escaped!"
52- />
40+ {% block alert_success_example %}
41+ <twig:Alert message =" I am a success alert!" />
5342 {% endblock %}
5443 </div >
44+ </div >
45+
46+ <div class =" row my-2" >
5547 <div class =" col-6" >
5648 <twig:CodeBlock
5749 filename =" templates/ux_packages/twig_component.html.twig"
6153 height =" auto"
6254 />
6355 </div >
56+ <div class =" col-6" >
57+ {% block alert_danger_example %}
58+ <twig:Alert
59+ type =" danger"
60+ message =" Oh no! The dinos escaped!"
61+ />
62+ {% endblock %}
63+ </div >
6464 </div >
6565{% endblock %}
You can’t perform that action at this time.
0 commit comments