Skip to content

Commit

Permalink
Improve HTTP method badge
Browse files Browse the repository at this point in the history
  • Loading branch information
jessarcher committed Sep 1, 2023
1 parent f8192d6 commit c8db68b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions resources/views/components/http-method-badge.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

@php
$colorClasses = match ($method) {
'GET' => 'text-purple-600 bg-purple-200',
'OPTIONS' => 'text-purple-600 bg-purple-200',
'POST' => 'text-blue-600 bg-blue-200',
'PATCH' => 'text-blue-600 bg-blue-200',
'PUT' => 'text-blue-600 bg-blue-200',
'DELETE' => 'text-red-600 bg-red-200',
default => 'text-gray-600 bg-gray-200',
'GET', 'OPTIONS' => 'text-purple-600 bg-purple-200 border-purple-300',
'POST', 'PUT', 'PATCH' => 'text-blue-600 bg-blue-200 border-blue-300',
'DELETE' => 'text-red-600 bg-red-200 border-red-300',
default => 'text-gray-600 bg-gray-200 border-gray-300',
}
@endphp

<span {{ $attributes->merge(['class' => "text-xs font-mono px-1 rounded font-semibold $colorClasses"]) }}>{{ $method }}</span>
<span {{ $attributes->merge(['class' => "text-xs font-mono px-1 border rounded font-semibold $colorClasses"]) }}>{{ $method }}</span>

0 comments on commit c8db68b

Please sign in to comment.