generated from filamentphp/plugin-skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19f6690
commit 325cec1
Showing
18 changed files
with
309 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<x-dynamic-component :component="$getEntryWrapperView()" :entry="$entry"> | ||
<x-filament-simple-alert::simple-alert | ||
:icon="$getIcon()" | ||
:color="$getColor()" | ||
:title="$getTitle()" | ||
:description="$getDescription()" | ||
:link="$getLink()" | ||
:link-label="$getLinkLabel()" | ||
:link-blank="$getLinkBlank()" | ||
/> | ||
</x-dynamic-component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field"> | ||
<x-filament-simple-alert::simple-alert | ||
:icon="$getIcon()" | ||
:color="$getColor()" | ||
:title="$getTitle()" | ||
:description="$getDescription()" | ||
:link="$getLink()" | ||
:link-label="$getLinkLabel()" | ||
:link-blank="$getLinkBlank()" | ||
/> | ||
</x-dynamic-component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
||
<div | ||
x-data="{}" | ||
class="filament-simple-alert rounded-md bg-custom-50 p-4 dark:bg-gray-900 dark:ring-white/10" | ||
style="{{ $colors }}"> | ||
<div class="flex"> | ||
@if($icon) | ||
<div class="flex-shrink-0 self-center"> | ||
<x-filament::icon | ||
icon="{{ $icon }}" | ||
class="h-5 w-5 h-5 w-5 text-custom-400" | ||
/> | ||
</div> | ||
@endif | ||
<div class="ml-3 flex-1 md:flex md:justify-between"> | ||
<div> | ||
<p class="text-sm font-medium text-custom-800 dark:text-white"> | ||
{!! $title !!} | ||
</p> | ||
<p class="text-sm text-custom-700 dark:text-white"> | ||
{!! $description !!} | ||
</p> | ||
</div> | ||
@if($link) | ||
<p class="mt-3 text-sm md:ml-6 md:mt-0 self-center"> | ||
<a href="{{ $link }}" {{ $linkBlank ? 'target="_blank"' : '' }} class="whitespace-nowrap font-medium text-custom-400 hover:text-custom-500"> | ||
{{ $linkLabel }} | ||
<span aria-hidden="true"> →</span> | ||
</a> | ||
</p> | ||
@endif | ||
</div> | ||
</div> | ||
</div> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace CodeWithDennis\SimpleAlert\Components\Concerns; | ||
|
||
use Closure; | ||
|
||
trait HasColor | ||
{ | ||
protected string $color = 'gray'; | ||
|
||
public function color(Closure|string $color): static | ||
{ | ||
$this->color = $color; | ||
|
||
return $this; | ||
} | ||
|
||
public function getColor(): string | ||
{ | ||
return $this->evaluate($this->color); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace CodeWithDennis\SimpleAlert\Components\Concerns; | ||
|
||
use Closure; | ||
|
||
trait HasDescription | ||
{ | ||
protected Closure|string|null $description = null; | ||
|
||
public function description(Closure|string $description): static | ||
{ | ||
$this->description = $description; | ||
|
||
return $this; | ||
} | ||
|
||
public function getDescription(): ?string | ||
{ | ||
return $this->evaluate($this->description); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace CodeWithDennis\SimpleAlert\Components\Concerns; | ||
|
||
use Closure; | ||
|
||
trait HasIcon | ||
{ | ||
protected Closure|string|null $icon = null; | ||
|
||
public function icon(Closure|string $icon): static | ||
{ | ||
$this->icon = $icon; | ||
|
||
return $this; | ||
} | ||
|
||
public function getIcon(): ?string | ||
{ | ||
return $this->evaluate($this->icon); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace CodeWithDennis\SimpleAlert\Components\Concerns; | ||
|
||
use Closure; | ||
|
||
trait Haslink | ||
{ | ||
protected Closure|string|null $link = null; | ||
|
||
protected Closure|string $linkLabel = 'Details'; | ||
|
||
protected Closure|bool|null $linkBlank = false; | ||
|
||
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 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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace CodeWithDennis\SimpleAlert\Components\Concerns; | ||
|
||
trait HasSimple | ||
{ | ||
public function danger(): static | ||
{ | ||
$this->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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace CodeWithDennis\SimpleAlert\Components\Concerns; | ||
|
||
use Closure; | ||
|
||
trait HasTitle | ||
{ | ||
protected Closure|string|null $title = null; | ||
|
||
public function title(Closure|string $title): static | ||
{ | ||
$this->title = $title; | ||
|
||
return $this; | ||
} | ||
|
||
public function getTitle(): ?string | ||
{ | ||
return $this->evaluate($this->title); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace CodeWithDennis\SimpleAlert\Components\Forms; | ||
|
||
use CodeWithDennis\SimpleAlert\Components\Concerns\HasColor; | ||
use CodeWithDennis\SimpleAlert\Components\Concerns\HasDescription; | ||
use CodeWithDennis\SimpleAlert\Components\Concerns\HasIcon; | ||
use CodeWithDennis\SimpleAlert\Components\Concerns\Haslink; | ||
use CodeWithDennis\SimpleAlert\Components\Concerns\HasSimple; | ||
use CodeWithDennis\SimpleAlert\Components\Concerns\HasTitle; | ||
use Filament\Forms\Components\Field; | ||
|
||
class SimpleAlert extends Field | ||
{ | ||
use HasColor; | ||
use HasDescription; | ||
use HasIcon; | ||
use Haslink; | ||
use HasSimple; | ||
use HasTitle; | ||
|
||
protected string $view = 'filament-simple-alert::components.simple-alert-field'; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->hiddenLabel(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace CodeWithDennis\SimpleAlert\Components\Infolists; | ||
|
||
use CodeWithDennis\SimpleAlert\Components\Concerns\HasColor; | ||
use CodeWithDennis\SimpleAlert\Components\Concerns\HasDescription; | ||
use CodeWithDennis\SimpleAlert\Components\Concerns\HasIcon; | ||
use CodeWithDennis\SimpleAlert\Components\Concerns\Haslink; | ||
use CodeWithDennis\SimpleAlert\Components\Concerns\HasSimple; | ||
use CodeWithDennis\SimpleAlert\Components\Concerns\HasTitle; | ||
use Filament\Infolists\Components\Entry; | ||
|
||
class SimpleAlert extends Entry | ||
{ | ||
use HasColor; | ||
use HasDescription; | ||
use HasIcon; | ||
use Haslink; | ||
use HasSimple; | ||
use HasTitle; | ||
|
||
protected string $view = 'filament-simple-alert::components.simple-alert-entry'; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->hiddenLabel(); | ||
} | ||
} |
Oops, something went wrong.