<?php

namespace App\View\Ui;

use App\View\Traits\HasColors;
use Illuminate\View\Component;

class Action extends Component
{

    use HasColors;

    public function __construct(
        public string $icon,
        public string $variant = 'primary'
    ) {
    }

    public function render()
    {
        return <<<'HTML'
            <a v-tooltip.raw="{{$slot}}" href="#" {{ $attributes }} class="inline-flex
                w-6 h-5 flex items-center justify-center rounded {{ $allColors($variant) }}
            ">
                <x-ui::sprite class="w-3 h-3 flex-none" :src="$icon"></x-ui::sprite>
            </a>
        HTML;
    }
}
