1
0
Fork 0
wow-raid-bingo/resources/views/components/button.blade.php

35 lines
815 B
PHP

@props(['href' => false, 'type' => 'default', 'element' => false])
@php
switch($type) {
case 'info':
$color = 'bg-blue-400 hover:bg-blue-500';
break;
case 'success':
$color = 'bg-green-400 hover:bg-green-500';
break;
case 'warning':
$color = 'bg-yellow-400 hover:bg-yellow-500';
break;
case 'danger':
$color = 'bg-red-400 hover:bg-red-500';
break;
default:
$color = 'bg-gray-400 hover:bg-gray-500';
}
if ($href) {
$element = 'a';
$attributes = $attributes->merge([ 'href' => $href ]);
} else if ($element == 'input') {
$attributes = $attributes->merge([ 'type' => 'submit' ]);
} else {
$element = 'button';
}
@endphp
<{{$element}} {{ $attributes->merge(['class' => "cursor-pointer inline-block px-4 py-2 rounded $color"]) }}>
{{ $slot }}
</{{$element}}>