Skip to content

Commit fb90c58

Browse files
committed
Use v4 schema component
1 parent 1523ac4 commit fb90c58

File tree

5 files changed

+30
-109
lines changed

5 files changed

+30
-109
lines changed

resources/views/components/simple-alert-entry.blade.php

Lines changed: 0 additions & 16 deletions
This file was deleted.

resources/views/components/simple-alert-field.blade.php

Lines changed: 0 additions & 16 deletions
This file was deleted.

resources/views/components/simple-alert.blade.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,65 +17,65 @@
1717
use function Filament\Support\get_color_css_variables;
1818
1919
$colors = \Illuminate\Support\Arr::toCssStyles([
20-
get_color_css_variables($color, shades: [50, 100, 400, 500, 700, 800]),
21-
]);
20+
get_color_css_variables($getColor(), shades: [50, 100, 400, 500, 700, 800]),
21+
]);
2222
2323
$iconClasses = \Illuminate\Support\Arr::toCssClasses([
2424
'h-5 w-5 text-custom-400',
25-
$iconAnimation,
25+
$getIconAnimation(),
2626
]);
2727
@endphp
2828

2929
<div x-data="{}"
3030
{{ $attributes->class([
3131
'filament-simple-alert rounded-md bg-custom-50 p-4 dark:bg-custom-400/10',
32-
'ring-1 ring-custom-100 dark:ring-custom-500/70' => $border,
32+
'ring-1 ring-custom-100 dark:ring-custom-500/70' => $getBorder(),
3333
]) }}
3434
style="{{ $colors }}">
3535
<div class="flex gap-3">
36-
@if($icon)
36+
@if($getIcon())
3737
<div @class([
3838
'flex-shrink-0',
39-
$iconVerticalAlignment === 'start' ? 'self-start' : 'self-center',
39+
$getIconVerticalAlignment() === 'start' ? 'self-start' : 'self-center',
4040
])>
4141
<x-filament::icon
42-
:icon="$icon"
43-
:class="$iconClasses"
42+
:icon="$getIcon()"
43+
:class="$iconClasses"
4444
/>
4545
</div>
4646
@endif
4747
<div class="items-center flex-1 md:flex md:justify-between space-y-3 md:space-y-0 md:gap-3">
48-
@if($title || $description)
48+
@if($getTitle() || $getDescription())
4949
<div class="space-y-0.5">
50-
@if($title)
50+
@if($getTitle())
5151
<p class="text-sm font-medium text-custom-800 dark:text-white">
52-
{{ $title }}
52+
{{ $getTitle() }}
5353
</p>
5454
@endif
55-
@if($description)
55+
@if($getDescription())
5656
<p class="text-sm text-custom-700 dark:text-white">
57-
{{ $description }}
57+
{{ $getDescription() }}
5858
</p>
5959
@endif
6060
</div>
6161
@endif
62-
@if($link || $actions)
62+
@if($getLink() || $getActions())
6363
<div @class([
6464
'flex items-center gap-3',
65-
$actionsVerticalAlignment === 'start' ? 'self-start' : 'self-center',
65+
$getActionsVerticalAlignment() === 'start' ? 'self-start' : 'self-center',
6666
])>
6767
<div class="flex items-center whitespace-nowrap gap-3">
68-
@if($link)
68+
@if($getLink())
6969
<p class="text-sm md:mt-0 self-center">
70-
<a href="{{ $link }}" {{ $linkBlank ? 'target="_blank"' : '' }} class="whitespace-nowrap font-medium text-custom-400 hover:text-custom-500">
71-
{{ $linkLabel }}
72-
<span aria-hidden="true"> &rarr;</span>
70+
<a href="{{ $getLink() }}" {{ $getLinkBlank() ? 'target="_blank"' : '' }} class="whitespace-nowrap font-medium text-custom-400 hover:text-custom-500">
71+
{{ $getLinkLabel() }}
72+
<span aria-hidden="true"> </span>
7373
</a>
7474
</p>
7575
@endif
76-
@if($actions)
76+
@if($getActions())
7777
<div class="gap-3 flex items-center justify-start">
78-
@foreach ($actions as $action)
78+
@foreach ($getActions() as $action)
7979
@if ($action->isVisible())
8080
{{ $action }}
8181
@endif

src/Components/Forms/SimpleAlert.php

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace CodeWithDennis\SimpleAlert\Components\Infolists;
3+
namespace CodeWithDennis\SimpleAlert\Components;
44

55
use Closure;
66
use CodeWithDennis\SimpleAlert\Components\Concerns\HasActionVerticalAlignment;
@@ -12,9 +12,9 @@
1212
use CodeWithDennis\SimpleAlert\Components\Concerns\HasLink;
1313
use CodeWithDennis\SimpleAlert\Components\Concerns\HasSimple;
1414
use CodeWithDennis\SimpleAlert\Components\Concerns\HasTitle;
15-
use Filament\Infolists\Components\Entry;
15+
use Filament\Schemas\Components\Component;
1616

17-
class SimpleAlert extends Entry
17+
class SimpleAlert extends Component
1818
{
1919
use HasActionVerticalAlignment;
2020
use HasBorder;
@@ -26,19 +26,17 @@ class SimpleAlert extends Entry
2626
use HasSimple;
2727
use HasTitle;
2828

29-
protected string $view = 'filament-simple-alert::components.simple-alert-entry';
29+
protected string $view = 'filament-simple-alert::components.simple-alert';
3030

31-
public function actions(array|Closure $actions): static
31+
public static function make(): static
3232
{
33-
$this->actions = $actions;
34-
35-
return $this;
33+
return app(static::class);
3634
}
3735

38-
protected function setUp(): void
36+
public function actions(array|Closure $actions): static
3937
{
40-
parent::setUp();
38+
$this->actions = $actions;
4139

42-
$this->hiddenLabel();
40+
return $this;
4341
}
4442
}

0 commit comments

Comments
 (0)