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 11
11
12
12
namespace App \Twig ;
13
13
14
- use App \Service \UxPackageRepository ;
15
14
use Symfony \UX \TwigComponent \Attribute \AsTwigComponent ;
16
15
17
16
#[AsTwigComponent]
@@ -20,20 +19,11 @@ class Alert
20
19
public string $ type = 'success ' ;
21
20
public string $ message ;
22
21
23
- public function __construct (private UxPackageRepository $ packageRepository )
24
- {
25
- }
26
-
27
22
public function getIcon (): string
28
23
{
29
24
return match ($ this ->type ) {
30
- 'success ' => 'circle- check ' ,
31
- 'danger ' => 'circle- exclamation ' ,
25
+ 'success ' => 'bi: check-circle ' ,
26
+ 'danger ' => 'bi: exclamation-circle ' ,
32
27
};
33
28
}
34
-
35
- public function getPackageCount (): int
36
- {
37
- return $ this ->packageRepository ->count ();
38
- }
39
29
}
Original file line number Diff line number Diff line change 1
1
<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 " />
3
3
{{ message }}
4
4
</div >
Original file line number Diff line number Diff line change 26
26
{% block demo_title %}UX Twig Components{% endblock %}
27
27
28
28
{% 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" >
35
30
<div class =" col-6" >
36
31
<twig:CodeBlock
37
32
filename =" templates/ux_packages/twig_component.html.twig"
41
36
height =" auto"
42
37
/>
43
38
</div >
44
- </div >
45
-
46
- <div class =" row my-2 align-items-center" >
47
39
<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!" />
53
42
{% endblock %}
54
43
</div >
44
+ </div >
45
+
46
+ <div class =" row my-2" >
55
47
<div class =" col-6" >
56
48
<twig:CodeBlock
57
49
filename =" templates/ux_packages/twig_component.html.twig"
61
53
height =" auto"
62
54
/>
63
55
</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 >
64
64
</div >
65
65
{% endblock %}
You can’t perform that action at this time.
0 commit comments