diff --git a/img.png b/img.png deleted file mode 100644 index 52edb8c..0000000 Binary files a/img.png and /dev/null differ diff --git a/resources/views/components/simple-alert-entry.blade.php b/resources/views/components/simple-alert-entry.blade.php new file mode 100644 index 0000000..9ad2419 --- /dev/null +++ b/resources/views/components/simple-alert-entry.blade.php @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/resources/views/components/simple-alert-field.blade.php b/resources/views/components/simple-alert-field.blade.php new file mode 100644 index 0000000..efb0090 --- /dev/null +++ b/resources/views/components/simple-alert-field.blade.php @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/resources/views/components/simple-alert.blade.php b/resources/views/components/simple-alert.blade.php new file mode 100644 index 0000000..a81282e --- /dev/null +++ b/resources/views/components/simple-alert.blade.php @@ -0,0 +1,51 @@ +@props([ + 'icon' => null, + 'color' => null, + 'title' => null, + 'description' => null, + 'link' => null, + 'linkLabel' => null, + 'linkBlank' => false, +]) + +@php + use function Filament\Support\get_color_css_variables; + + $colors = \Illuminate\Support\Arr::toCssStyles([ + get_color_css_variables($color, shades: [50, 400, 500, 600, 700, 800]), + ]); +@endphp + +
+
+ @if($icon) +
+ +
+ @endif +
+
+

+ {!! $title !!} +

+

+ {!! $description !!} +

+
+ @if($link) +

+ + {{ $linkLabel }} + + +

+ @endif +
+
+
\ No newline at end of file diff --git a/resources/views/simple-alert.blade.php b/resources/views/simple-alert.blade.php deleted file mode 100644 index ea18f5c..0000000 --- a/resources/views/simple-alert.blade.php +++ /dev/null @@ -1,40 +0,0 @@ -@php - use Filament\Support\Facades\FilamentAsset;use function Filament\Support\get_color_css_variables; - - $colors = \Illuminate\Support\Arr::toCssStyles([ - get_color_css_variables($getType(), shades: [50, 400, 500, 600, 700, 800]), - ]); -@endphp - - -
-
- @if($getIcon()) -
- -
- @endif -
-
-

- {!! $getTitle() !!} -

-

- {!! $getDescription() !!} -

-
- @if($getLink()) -

- - {{ $getLinkLabel() }} - - -

- @endif -
-
-
-
\ No newline at end of file diff --git a/src/Components/Concerns/HasColor.php b/src/Components/Concerns/HasColor.php new file mode 100644 index 0000000..434964e --- /dev/null +++ b/src/Components/Concerns/HasColor.php @@ -0,0 +1,22 @@ +color = $color; + + return $this; + } + + public function getColor(): string + { + return $this->evaluate($this->color); + } +} diff --git a/src/Components/Concerns/HasDescription.php b/src/Components/Concerns/HasDescription.php new file mode 100644 index 0000000..9b3bc7f --- /dev/null +++ b/src/Components/Concerns/HasDescription.php @@ -0,0 +1,22 @@ +description = $description; + + return $this; + } + + public function getDescription(): ?string + { + return $this->evaluate($this->description); + } +} diff --git a/src/Components/Concerns/HasIcon.php b/src/Components/Concerns/HasIcon.php new file mode 100644 index 0000000..667760b --- /dev/null +++ b/src/Components/Concerns/HasIcon.php @@ -0,0 +1,22 @@ +icon = $icon; + + return $this; + } + + public function getIcon(): ?string + { + return $this->evaluate($this->icon); + } +} diff --git a/src/Components/Concerns/HasLink.php b/src/Components/Concerns/HasLink.php new file mode 100644 index 0000000..e01ca22 --- /dev/null +++ b/src/Components/Concerns/HasLink.php @@ -0,0 +1,50 @@ +link = $link; + + return $this; + } + + public function linkLabel(Closure|string $linkLabel): static + { + $this->linkLabel = $linkLabel; + + return $this; + } + + public function linkBlank(Closure|string $linkBlank): static + { + $this->linkBlank = $linkBlank; + + return $this; + } + + public function getLink(): ?string + { + return $this->evaluate($this->link); + } + + public function getLinkLabel(): string + { + return $this->evaluate($this->linkLabel); + } + + public function getLinkBlank(): bool + { + return $this->evaluate($this->linkBlank); + } +} diff --git a/src/Components/Concerns/HasSimple.php b/src/Components/Concerns/HasSimple.php new file mode 100644 index 0000000..ff216d1 --- /dev/null +++ b/src/Components/Concerns/HasSimple.php @@ -0,0 +1,38 @@ +color = 'danger'; + $this->icon = 'heroicon-s-x-circle'; + + return $this; + } + + public function info(): static + { + $this->color = 'info'; + $this->icon = 'heroicon-s-information-circle'; + + return $this; + } + + public function success(): static + { + $this->color = 'success'; + $this->icon = 'heroicon-s-check-circle'; + + return $this; + } + + public function warning(): static + { + $this->color = 'warning'; + $this->icon = 'heroicon-s-exclamation-triangle'; + + return $this; + } +} diff --git a/src/Components/Concerns/HasTitle.php b/src/Components/Concerns/HasTitle.php new file mode 100644 index 0000000..737ce57 --- /dev/null +++ b/src/Components/Concerns/HasTitle.php @@ -0,0 +1,22 @@ +title = $title; + + return $this; + } + + public function getTitle(): ?string + { + return $this->evaluate($this->title); + } +} diff --git a/src/Components/Forms/SimpleAlert.php b/src/Components/Forms/SimpleAlert.php new file mode 100644 index 0000000..2617b0c --- /dev/null +++ b/src/Components/Forms/SimpleAlert.php @@ -0,0 +1,30 @@ +hiddenLabel(); + } +} diff --git a/src/Components/Infolists/SimpleAlert.php b/src/Components/Infolists/SimpleAlert.php new file mode 100644 index 0000000..7e13770 --- /dev/null +++ b/src/Components/Infolists/SimpleAlert.php @@ -0,0 +1,30 @@ +hiddenLabel(); + } +} diff --git a/src/Components/SimpleAlertEntry.php b/src/Components/SimpleAlertEntry.php deleted file mode 100644 index 1b26b5a..0000000 --- a/src/Components/SimpleAlertEntry.php +++ /dev/null @@ -1,148 +0,0 @@ -hiddenLabel(); - } - - public function danger(): static - { - $this->type = 'danger'; - $this->icon = 'heroicon-s-x-circle'; - - return $this; - } - - public function info(): static - { - $this->type = 'info'; - $this->icon = 'heroicon-s-information-circle'; - - return $this; - } - - public function success(): static - { - $this->type = 'success'; - $this->icon = 'heroicon-s-check-circle'; - - return $this; - } - - public function warning(): static - { - $this->type = 'warning'; - $this->icon = 'heroicon-s-exclamation-triangle'; - - return $this; - } - - public function color(Closure|string $color): static - { - $this->type = $color; - - return $this; - } - - public function icon(Closure|string $icon): static - { - $this->icon = $icon; - - return $this; - } - - public function link(Closure|string $link): static - { - $this->link = $link; - - return $this; - } - - public function linkLabel(Closure|string $linkLabel): static - { - $this->linkLabel = $linkLabel; - - return $this; - } - - public function linkBlank(Closure|string $linkBlank): static - { - $this->linkBlank = $linkBlank; - - return $this; - } - - public function title(Closure|string $title): static - { - $this->title = $title; - - return $this; - } - - public function description(Closure|string $description): static - { - $this->description = $description; - - return $this; - } - - public function getType(): string - { - return $this->type; - } - - public function getLink(): ?string - { - return $this->evaluate($this->link); - } - - public function getLinkLabel(): ?string - { - return $this->evaluate($this->linkLabel); - } - - public function getBlank(): bool - { - return $this->evaluate($this->linkBlank); - } - - public function getTitle(): ?string - { - return $this->evaluate($this->title); - } - - public function getDescription(): ?string - { - return $this->evaluate($this->description); - } - - public function getIcon(): ?string - { - return $this->evaluate($this->icon); - } -} diff --git a/tests/ArchTest.php b/tests/ArchTest.php deleted file mode 100644 index ccc19b2..0000000 --- a/tests/ArchTest.php +++ /dev/null @@ -1,5 +0,0 @@ -expect(['dd', 'dump', 'ray']) - ->each->not->toBeUsed(); diff --git a/tests/ExampleTest.php b/tests/ExampleTest.php deleted file mode 100644 index 5d36321..0000000 --- a/tests/ExampleTest.php +++ /dev/null @@ -1,5 +0,0 @@ -toBeTrue(); -}); diff --git a/tests/Pest.php b/tests/Pest.php deleted file mode 100644 index 63533ca..0000000 --- a/tests/Pest.php +++ /dev/null @@ -1,5 +0,0 @@ -in(__DIR__); diff --git a/tests/TestCase.php b/tests/TestCase.php deleted file mode 100644 index 7c0991f..0000000 --- a/tests/TestCase.php +++ /dev/null @@ -1,60 +0,0 @@ - 'CodeWithDennis\\SimpleAlert\\Database\\Factories\\'.class_basename($modelName).'Factory' - ); - } - - protected function getPackageProviders($app) - { - return [ - ActionsServiceProvider::class, - BladeCaptureDirectiveServiceProvider::class, - BladeHeroiconsServiceProvider::class, - BladeIconsServiceProvider::class, - FilamentServiceProvider::class, - FormsServiceProvider::class, - InfolistsServiceProvider::class, - LivewireServiceProvider::class, - NotificationsServiceProvider::class, - SupportServiceProvider::class, - TablesServiceProvider::class, - WidgetsServiceProvider::class, - SimpleAlertServiceProvider::class, - ]; - } - - public function getEnvironmentSetUp($app) - { - config()->set('database.default', 'testing'); - - /* - $migration = include __DIR__.'/../database/migrations/create_filament-simple-alert_table.php.stub'; - $migration->up(); - */ - } -}