File tree 3 files changed +46
-1
lines changed
resources/views/infolists/components
3 files changed +46
-1
lines changed Original file line number Diff line number Diff line change
1
+ @php
2
+ use JaOcero\ActivityTimeline\Enums\ IconAnimation ;
3
+ @endphp
1
4
@if ($icon = $getIcon ($getState ()) )
2
5
@php
3
6
$color = $getColor ($getState ()) ?? ' gray' ;
7
+ $animation = $getAnimation ($getState ());
4
8
@endphp
5
9
6
- <div class =" relative flex items-center justify-center w-8 h-8" >
10
+ <div @class ([
11
+ ' relative flex items-center justify-center w-8 h-8' ,
12
+ match ($animation ) {
13
+ IconAnimation:: Spin , ' spin' => ' animate-spin' ,
14
+ IconAnimation:: Ping , ' ping' => ' animate-ping' ,
15
+ IconAnimation:: Pulse , ' pulse' => ' animate-pulse' ,
16
+ IconAnimation:: Bounce , ' bounce' => ' animate-bounce' ,
17
+ default => $animation ,
18
+ },
19
+ ] )>
7
20
<span @class ([
8
21
' flex flex-shrink-0 p-[5px] w-8 h-8 justify-center items-center dark:border rounded-full dark:bg-gray-800 dark:border-gray-700' ,
9
22
match ($color ) {
Original file line number Diff line number Diff line change 2
2
3
3
namespace JaOcero \ActivityTimeline \Components ;
4
4
5
+ use Closure ;
5
6
use Filament \Infolists \Components \IconEntry ;
7
+ use JaOcero \ActivityTimeline \Enums \IconAnimation ;
6
8
7
9
class ActivityIcon extends IconEntry
8
10
{
9
11
protected string $ viewIdentifier = 'activityIcon ' ;
10
12
13
+ protected IconAnimation |string |Closure |null $ animation = null ;
14
+
11
15
protected string $ view = 'activity-timeline::infolists.components.activity-icon ' ;
12
16
17
+ public function animation (IconAnimation |string |Closure |null $ animation ): static
18
+ {
19
+ $ this ->animation = $ animation ;
20
+
21
+ return $ this ;
22
+ }
23
+
24
+ public function getAnimation (mixed $ state ): IconAnimation |string |null
25
+ {
26
+ return $ this ->evaluate ($ this ->animation , [
27
+ 'state ' => $ state ,
28
+ ]);
29
+ }
30
+
13
31
public function getViewIdentifier (): string
14
32
{
15
33
return $ this ->viewIdentifier ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace JaOcero \ActivityTimeline \Enums ;
4
+
5
+ enum IconAnimation: string
6
+ {
7
+ case Spin = 'spin ' ;
8
+
9
+ case Ping = 'ping ' ;
10
+
11
+ case Pulse = 'pulse ' ;
12
+
13
+ case Bounce = 'bounce ' ;
14
+ }
You can’t perform that action at this time.
0 commit comments