199ocero / activity-timeline

Add timelines to custom pages or infolist entries effortlessly. Plus, it teams up smoothly with Spatie Activitylog for easy tracking.
https://filamentphp.com/plugins/jaocero-activity-timeline
MIT License
63 stars 16 forks source link

Add possibility to animate icon #32

Open agencetwogether opened 3 days ago

agencetwogether commented 3 days ago

Hello,

I made a little contribution, a possibility to animate icon in activity timeline according to tailwind presets animation (animate-spin, animate-pin, animate-pulse, animate-bounce)

So for example, if you want animate an icon you can use

ActivityIcon::make('status')
 //with Enum
 //->animation(IconAnimation::Pulse)
 //or with a closure
  ->animation(fn (?string $state) => match ($state) {
      'current' => IconAnimation::Pulse,
      default => null,
  })
  //or with a string
  ->animation('animate-ping')
  ->icon(fn (?string $state): ?string => match ($state) {
      'current' => 'heroicon-m-light-bulb',
      default => 'heroicon-o-light-bulb',
  })

Closure, Enum, or string are possibilities.