@props([
    'type' => 'primary',
    'dismissible' => true,
    'icon' => null
])

@php
$icons = [
    'primary' => 'ri-user-smile-line',
    'secondary' => 'ri-check-double-line',
    'success' => 'ri-check-double-line',
    'danger' => 'ri-error-warning-line',
    'warning' => 'ri-alert-line',
    'info' => 'ri-information-line',
];
$alertIcon = $icon ?? ($icons[$type] ?? 'ri-notification-off-line');
@endphp

<div {{ $attributes->merge(['class' => 'alert alert-' . $type . ' alert-dismissible alert-label-icon label-arrow fade show']) }} role="alert">
    <i class="{{ $alertIcon }} label-icon"></i>
    {{ $slot }}
    @if($dismissible)
    <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
    @endif
</div>
