empty-state.blade.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. @php
  2. use Filament\Support\Enums\IconSize;
  3. use Filament\Support\View\Components\SectionComponent\IconComponent;
  4. @endphp
  5. @props([
  6. 'description' => null,
  7. 'footer' => null,
  8. 'heading',
  9. 'headingTag' => 'h2',
  10. 'icon' => null,
  11. 'iconColor' => 'primary',
  12. 'iconSize' => null,
  13. ])
  14. @php
  15. if (filled($iconSize) && (! $iconSize instanceof IconSize)) {
  16. $iconSize = IconSize::tryFrom($iconSize) ?? $iconSize;
  17. }
  18. $hasDescription = filled((string) $description);
  19. $hasIcon = filled($icon);
  20. @endphp
  21. <section
  22. {{
  23. $attributes->class([
  24. 'fi-empty-state',
  25. ])
  26. }}
  27. >
  28. <div class="fi-empty-state-content">
  29. @if ($hasIcon)
  30. <div
  31. @class([
  32. 'fi-empty-state-icon-bg',
  33. 'fi-color ' . ('fi-color-' . $iconColor) => $iconColor !== 'gray',
  34. ])
  35. >
  36. {{
  37. \Filament\Support\generate_icon_html($icon, attributes: (new \Illuminate\View\ComponentAttributeBag)
  38. ->color(IconComponent::class, $iconColor), size: $iconSize ?? IconSize::Large)
  39. }}
  40. </div>
  41. @endif
  42. <{{ $headingTag }} class="fi-empty-state-heading">
  43. {{ $heading }}
  44. </{{ $headingTag }}>
  45. @if ($hasDescription)
  46. <p class="fi-empty-state-description">
  47. {{ $description }}
  48. </p>
  49. @endif
  50. <footer class="fi-empty-state-footer">
  51. {{ $footer }}
  52. </footer>
  53. </div>
  54. </section>