Skip to content

Commit

Permalink
🎨 Make the Alert component anonymous
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x committed Jan 4, 2024
1 parent 5cd2c43 commit 5b07f46
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 58 deletions.
57 changes: 0 additions & 57 deletions app/View/Components/Alert.php

This file was deleted.

14 changes: 13 additions & 1 deletion resources/views/components/alert.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
<div {{ $attributes->merge(['class' => $type]) }}>
@props([
'type' => null,
'message' => null,
])

@php($class = match ($type) {
'success' => 'text-green-50 bg-green-400',
'caution' => 'text-yellow-50 bg-yellow-400',
'warning' => 'text-red-50 bg-red-400',
default => 'text-indigo-50 bg-indigo-400',
})

<div {{ $attributes->merge(['class' => "px-2 py-1 {$class}"]) }}>
{!! $message ?? $slot !!}
</div>

0 comments on commit 5b07f46

Please sign in to comment.