diff --git a/app/View/Components/Alert.php b/app/View/Components/Alert.php index eba2d61af..943bccdd4 100644 --- a/app/View/Components/Alert.php +++ b/app/View/Components/Alert.php @@ -18,12 +18,18 @@ class Alert extends Component /** @var string */ public $icon; + /** @var string */ + public $typr; + /** @var string */ public $title; /** @var string */ public $description; + /** @var string */ + public $message; + /** @var array */ public $list; @@ -42,20 +48,26 @@ class Alert extends Component bool $rounded = true, bool $border = false, string $color = '', string $icon = '', + + string $type = '', - string $title = '', string $description = '', + string $title = '', string $description = '', string $message = '', array $list = [], array $actions = [], bool $dismiss = false ) { $this->rounded = $rounded; $this->border = $border; + $this->type = $type; + $this->color = $this->getColor($color); $this->icon = $this->getIcon($icon); $this->title = $title; $this->description = $description; + $this->message = $message; + $this->list = $list; $this->actions = $actions; @@ -78,7 +90,24 @@ class Alert extends Component return $color; } - $color = 'green'; + switch ($this->type) { + case 'success': + $color = 'green'; + break; + case 'info': + $color = 'blue'; + break; + case 'warning': + $color = 'orange'; + break; + case 'danger': + case 'error': + $color = 'red'; + break; + default: + $color = 'green'; + break; + } return $color; } @@ -89,7 +118,24 @@ class Alert extends Component return $icon; } - $icon = 'check_circle'; + switch ($this->type) { + case 'success': + $icon = 'check_circle'; + break; + case 'info': + $icon = 'info'; + break; + case 'warning': + $icon = 'warning'; + break; + case 'danger': + case 'error': + $icon = 'error'; + break; + default: + $icon = 'check_circle'; + break; + } return $icon; } diff --git a/resources/views/components/alert/border.blade.php b/resources/views/components/alert/border.blade.php index 1224e68b8..8821c6688 100644 --- a/resources/views/components/alert/border.blade.php +++ b/resources/views/components/alert/border.blade.php @@ -7,6 +7,7 @@ :title="$title" :description="$description" + :message="$message" :list="$list" :actions="$actions" diff --git a/resources/views/components/alert/danger.blade.php b/resources/views/components/alert/danger.blade.php index 8bedf43e7..25f284853 100644 --- a/resources/views/components/alert/danger.blade.php +++ b/resources/views/components/alert/danger.blade.php @@ -4,6 +4,7 @@ :title="$title" :description="$description" + :message="$message" :list="$list" :rounded="$rounded" diff --git a/resources/views/components/alert/index.blade.php b/resources/views/components/alert/index.blade.php index 85b70dc39..137bc3490 100644 --- a/resources/views/components/alert/index.blade.php +++ b/resources/views/components/alert/index.blade.php @@ -2,8 +2,9 @@ @class([ 'rounded-md' => $rounded, 'border-l-4 border-' . $color . '-400' => $border, - 'bg-' . $color . '-50', - 'p-4', + 'bg-' . $color . '-50' => $color != 'green', + 'bg-' . $color . '-100' => $color == 'green', + 'p-4 my-4', ]) x-data > @@ -13,21 +14,31 @@
{{ $description }}
+ @if ($description || $list) +{!! $description !!}
- @if ($list) -+ {!! $message !!} +
+ @endif @if ($actions)