app/app/Components/CreateButton.php
2024-10-18 08:29:21 +02:00

30 lines
780 B
PHP

<?php
namespace App\Components;
use PHPNative\UI\Collection\Views;
use PHPNative\UI\Widget\Button;
use PHPNative\UI\Widget\Icon;
use PHPNative\UI\Widget\Text;
class CreateButton extends Button
{
private Icon $icon;
private Text $text;
public function __construct(public string $label, string $style = '')
{
parent::__construct( style: "px-3 py-2 bg-red-400 hover:bg-blue-800 hover:text-green-500 h-50 rounded m-5");
$this->icon = new Icon(\PHPNative\Tailwind\Data\Icon::plus, style: 'text-white');
$this->text = new Text($this->label, 'text-xl text-white m-3');
}
public function getViews(): ?\PHPNative\UI\Collection\Views
{
return new Views([
$this->icon,
$this->text,
]);
}
}