2021-09-10 16:02:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace App\Views\Components\Forms;
|
|
|
|
|
2021-09-15 15:58:21 +00:00
|
|
|
use ViewComponents\Component;
|
|
|
|
|
|
|
|
class Section extends Component
|
2021-09-10 16:02:25 +00:00
|
|
|
{
|
|
|
|
protected string $title = '';
|
|
|
|
|
|
|
|
protected ?string $subtitle = null;
|
|
|
|
|
|
|
|
public function render(): string
|
|
|
|
{
|
2023-06-21 16:17:11 +00:00
|
|
|
$subtitle = $this->subtitle === null ? '' : '<p class="text-sm text-skin-muted">' . $this->subtitle . '</p>';
|
2021-09-10 16:02:25 +00:00
|
|
|
|
|
|
|
return <<<HTML
|
2022-01-23 16:53:23 +00:00
|
|
|
<fieldset class="w-full p-8 bg-elevated border-3 flex flex-col items-start border-subtle rounded-xl {$this->class}">
|
2021-09-10 16:02:25 +00:00
|
|
|
<Heading tagName="legend" class="float-left">{$this->title}</Heading>
|
|
|
|
{$subtitle}
|
2022-01-23 16:53:23 +00:00
|
|
|
<div class="flex flex-col w-0 min-w-full gap-4 py-4">{$this->slot}</div>
|
2021-09-10 16:02:25 +00:00
|
|
|
</fieldset>
|
|
|
|
HTML;
|
|
|
|
}
|
|
|
|
}
|