diff --git a/resources/views/components/empty-state.blade.php b/resources/views/components/empty-state.blade.php new file mode 100644 index 0000000..1be32da --- /dev/null +++ b/resources/views/components/empty-state.blade.php @@ -0,0 +1,25 @@ +@props([ + 'description' => null, + 'heading', + 'icon', +]) + +
class(['fi-ta-empty-state px-6 py-12']) }}> +
+
+ +
+ +

class(['fi-ta-empty-state-heading text-base font-semibold leading-6 text-gray-950 dark:text-white']) }}> + {{ $heading }} +

+ + @if ($description) +

class(['fi-ta-empty-state-description text-sm text-gray-500 dark:text-gray-400']) }}> + {{ $description }} +

+ @endif +
+
diff --git a/resources/views/infolists/components/activity-section.blade.php b/resources/views/infolists/components/activity-section.blade.php index dc33ed4..cce5a3f 100644 --- a/resources/views/infolists/components/activity-section.blade.php +++ b/resources/views/infolists/components/activity-section.blade.php @@ -36,27 +36,25 @@
+ @class(['flex flex-col'])> -
+
!$loop->last - ])> - {{ $activityIcon}} + 'relative last:after:hidden', + 'after:absolute after:top-7 after:bottom-0 after:start-4 after:w-px after:-translate-x-[0.5px] after:bg-gray-300 dark:after:bg-gray-700' => !$loop->last, + ])> + {{ $activityIcon }}
!$loop->last, - "mb-0" => $loop->last + 'grow pt-1 space-y-1', + 'mb-7' => !$loop->last, + 'mb-0' => $loop->last, ])> -
+
{{ $activityTitle }} @@ -69,7 +67,7 @@ {{-- End Description --}}
-
+
@endforeach @@ -88,5 +86,7 @@ class="cursor-pointer hover:underline">
+ @else + @endif diff --git a/src/Components/ActivitySection.php b/src/Components/ActivitySection.php index 87d091f..b0eb256 100644 --- a/src/Components/ActivitySection.php +++ b/src/Components/ActivitySection.php @@ -6,9 +6,12 @@ use Filament\Infolists\ComponentContainer; use Filament\Infolists\Components\Entry; use Illuminate\Database\Eloquent\Model; +use JaOcero\ActivityTimeline\Concerns\HasEmptyState; class ActivitySection extends Entry { + use HasEmptyState; + protected string $view = 'activity-timeline::infolists.components.activity-section'; protected string|Closure|null $description = null; @@ -106,7 +109,7 @@ public function getShowItemsColor(): string */ public function getChildComponentContainers(bool $withHidden = false): array { - if ((! $withHidden) && $this->isHidden()) { + if ((!$withHidden) && $this->isHidden()) { return []; } diff --git a/src/Concerns/HasEmptyState.php b/src/Concerns/HasEmptyState.php new file mode 100644 index 0000000..c6e3506 --- /dev/null +++ b/src/Concerns/HasEmptyState.php @@ -0,0 +1,55 @@ +emptyStateDescription = $description; + + return $this; + } + + public function emptyStateHeading(string | Htmlable | Closure | null $heading): static + { + $this->emptyStateHeading = $heading; + + return $this; + } + + public function emptyStateIcon(string | Closure | null $icon): static + { + $this->emptyStateIcon = $icon; + + return $this; + } + + public function getEmptyStateDescription(): string | Htmlable | null + { + return $this->evaluate($this->emptyStateDescription); + } + + public function getEmptyStateHeading(): string | Htmlable + { + return $this->evaluate($this->emptyStateHeading) ?? 'No ' . str($this->getName())->title(); + } + + public function getEmptyStateIcon(): string + { + return $this->evaluate($this->emptyStateIcon) ?? 'heroicon-o-x-mark'; + } +}