28 lines
911 B
PHP
28 lines
911 B
PHP
@props([
|
|
'status' => 'success',
|
|
])
|
|
<?php
|
|
|
|
// Define a mapping of status to its corresponding colors
|
|
$statusToColors = [
|
|
'success' => ['bg' => 'bg-green-100', 'text' => 'text-green-700'],
|
|
'error' => ['bg' => 'bg-red-100', 'text' => 'text-red-700'],
|
|
'warning' => ['bg' => 'bg-yellow-100', 'text' => 'text-yellow-800'],
|
|
'info' => ['bg' => 'bg-blue-100', 'text' => 'text-blue-700'],
|
|
'pending' => ['bg' => 'bg-gray-100', 'text' => 'text-gray-600'],
|
|
];
|
|
|
|
// Default to 'success' if the provided status is not in the defined array
|
|
if (!array_key_exists($status, $statusToColors)) {
|
|
$status = 'success';
|
|
}
|
|
|
|
// Get the color class for the given status
|
|
$colorClasses = $statusToColors[$status];
|
|
|
|
?>
|
|
|
|
<span {{ $attributes }} class="inline-flex items-center rounded-md {{ $colorClasses['bg'] }} px-1.5 py-0.5 text-xs font-medium {{ $colorClasses['text'] }}">
|
|
{{ $status }}
|
|
</span>
|