34 lines
996 B
PHP
34 lines
996 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\View\Ui;
|
||
|
|
||
|
use App\View\Traits\HasColors;
|
||
|
use Illuminate\View\Component;
|
||
|
|
||
|
class Badge extends Component
|
||
|
{
|
||
|
|
||
|
use HasColors;
|
||
|
|
||
|
public function __construct(
|
||
|
public string $icon,
|
||
|
public string $variant = 'primary'
|
||
|
) {
|
||
|
}
|
||
|
|
||
|
public function render()
|
||
|
{
|
||
|
return <<<'HTML'
|
||
|
<button type="button" href="#" {{ $attributes }} class="h-6 px-3 space-x-2 items-center rounded-full {{ $allColors($variant) }} hidden lg:flex">
|
||
|
<x-ui::sprite class="w-3 h-3 flex-none" :src="$icon"></x-ui::sprite>
|
||
|
<span class="text-sm">
|
||
|
{{$slot}}
|
||
|
</span>
|
||
|
</button>
|
||
|
<button type="button" x-tooltip.raw="{{$slot}}" href="#" {{ $attributes }} class="h-6 px-3 space-x-2 flex items-center rounded-full {{ $allColors($variant) }} lg:hidden">
|
||
|
<x-ui::sprite class="w-3 h-3 flex-none" :src="$icon"></x-ui::sprite>
|
||
|
</button>
|
||
|
HTML;
|
||
|
}
|
||
|
}
|