alert components typo
This commit is contained in:
parent
f940ac8e33
commit
3400f006af
@ -18,12 +18,18 @@ class Alert extends Component
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
public $icon;
|
public $icon;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $typr;
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public $title;
|
public $title;
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public $description;
|
public $description;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $message;
|
||||||
|
|
||||||
/** @var array */
|
/** @var array */
|
||||||
public $list;
|
public $list;
|
||||||
|
|
||||||
@ -43,19 +49,25 @@ class Alert extends Component
|
|||||||
|
|
||||||
string $color = '', string $icon = '',
|
string $color = '', string $icon = '',
|
||||||
|
|
||||||
string $title = '', string $description = '',
|
string $type = '',
|
||||||
|
|
||||||
|
string $title = '', string $description = '', string $message = '',
|
||||||
array $list = [], array $actions = [],
|
array $list = [], array $actions = [],
|
||||||
bool $dismiss = false
|
bool $dismiss = false
|
||||||
) {
|
) {
|
||||||
$this->rounded = $rounded;
|
$this->rounded = $rounded;
|
||||||
$this->border = $border;
|
$this->border = $border;
|
||||||
|
|
||||||
|
$this->type = $type;
|
||||||
|
|
||||||
$this->color = $this->getColor($color);
|
$this->color = $this->getColor($color);
|
||||||
$this->icon = $this->getIcon($icon);
|
$this->icon = $this->getIcon($icon);
|
||||||
|
|
||||||
$this->title = $title;
|
$this->title = $title;
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
|
|
||||||
|
$this->message = $message;
|
||||||
|
|
||||||
$this->list = $list;
|
$this->list = $list;
|
||||||
$this->actions = $actions;
|
$this->actions = $actions;
|
||||||
|
|
||||||
@ -78,7 +90,24 @@ class Alert extends Component
|
|||||||
return $color;
|
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;
|
return $color;
|
||||||
}
|
}
|
||||||
@ -89,7 +118,24 @@ class Alert extends Component
|
|||||||
return $icon;
|
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;
|
return $icon;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
:title="$title"
|
:title="$title"
|
||||||
:description="$description"
|
:description="$description"
|
||||||
|
:message="$message"
|
||||||
:list="$list"
|
:list="$list"
|
||||||
|
|
||||||
:actions="$actions"
|
:actions="$actions"
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
:title="$title"
|
:title="$title"
|
||||||
:description="$description"
|
:description="$description"
|
||||||
|
:message="$message"
|
||||||
:list="$list"
|
:list="$list"
|
||||||
|
|
||||||
:rounded="$rounded"
|
:rounded="$rounded"
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
@class([
|
@class([
|
||||||
'rounded-md' => $rounded,
|
'rounded-md' => $rounded,
|
||||||
'border-l-4 border-' . $color . '-400' => $border,
|
'border-l-4 border-' . $color . '-400' => $border,
|
||||||
'bg-' . $color . '-50',
|
'bg-' . $color . '-50' => $color != 'green',
|
||||||
'p-4',
|
'bg-' . $color . '-100' => $color == 'green',
|
||||||
|
'p-4 my-4',
|
||||||
])
|
])
|
||||||
x-data
|
x-data
|
||||||
>
|
>
|
||||||
@ -13,21 +14,31 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ml-3">
|
<div class="ml-3">
|
||||||
<h3 class="text-sm font-medium text-{{ $color }}-800">
|
@if ($title)
|
||||||
{{ $title }}
|
<h3 class="text-sm font-medium text-{{ $color }}-800">
|
||||||
</h3>
|
{!! $title !!}
|
||||||
|
</h3>
|
||||||
|
@endif
|
||||||
|
|
||||||
<div class="mt-2 text-sm text-{{ $color }}-700">
|
@if ($description || $list)
|
||||||
<p>{{ $description }}</p>
|
<div class="mt-2 text-sm text-{{ $color }}-700">
|
||||||
|
<p>{!! $description !!}</p>
|
||||||
|
|
||||||
@if ($list)
|
@if ($list)
|
||||||
<ul role="list" class="list-disc space-y-1 pl-5">
|
<ul role="list" class="list-disc space-y-1 pl-5">
|
||||||
@foreach ($list as $message)
|
@foreach ($list as $message)
|
||||||
<li>{{ $message }}</li>
|
<li>{!! $message !!}</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
</ul>
|
</ul>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if ($message)
|
||||||
|
<p class="text-sm font-medium text-{{ $color }}-800 inline-block align-middle">
|
||||||
|
{!! $message !!}
|
||||||
|
</p>
|
||||||
|
@endif
|
||||||
|
|
||||||
@if ($actions)
|
@if ($actions)
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
@ -83,7 +94,8 @@
|
|||||||
@class([
|
@class([
|
||||||
'inline-flex',
|
'inline-flex',
|
||||||
'rounded-md',
|
'rounded-md',
|
||||||
'bg-' . $color . '-50',
|
'bg-' . $color . '-50' => $color != 'green',
|
||||||
|
'bg-' . $color . '-100' => $color == 'green',
|
||||||
'p-1.5',
|
'p-1.5',
|
||||||
'text-sm font-medium',
|
'text-sm font-medium',
|
||||||
'text-' . $color . '-500 hover:bg-' . $color . '-100',
|
'text-' . $color . '-500 hover:bg-' . $color . '-100',
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
:title="$title"
|
:title="$title"
|
||||||
:description="$description"
|
:description="$description"
|
||||||
|
:message="$message"
|
||||||
:list="$list"
|
:list="$list"
|
||||||
|
|
||||||
:rounded="$rounded"
|
:rounded="$rounded"
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
:title="$title"
|
:title="$title"
|
||||||
:description="$description"
|
:description="$description"
|
||||||
|
:message="$message"
|
||||||
:list="$list"
|
:list="$list"
|
||||||
|
|
||||||
:rounded="$rounded"
|
:rounded="$rounded"
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
:title="$title"
|
:title="$title"
|
||||||
:description="$description"
|
:description="$description"
|
||||||
|
:message="$message"
|
||||||
:list="$list"
|
:list="$list"
|
||||||
|
|
||||||
:rounded="$rounded"
|
:rounded="$rounded"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user