2021-09-10 16:02:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace App\Views\Components\Forms;
|
|
|
|
|
2024-05-29 10:24:13 +00:00
|
|
|
use Override;
|
2021-09-15 15:58:21 +00:00
|
|
|
use ViewComponents\Component;
|
|
|
|
|
|
|
|
class Section extends Component
|
2021-09-10 16:02:25 +00:00
|
|
|
{
|
2024-05-09 17:55:41 +00:00
|
|
|
protected array $props = ['title', 'subtitle'];
|
2021-09-10 16:02:25 +00:00
|
|
|
|
2024-05-09 17:55:41 +00:00
|
|
|
protected string $title;
|
|
|
|
|
|
|
|
protected string $subtitle = '';
|
2021-09-10 16:02:25 +00:00
|
|
|
|
2024-05-29 10:24:13 +00:00
|
|
|
#[Override]
|
2021-09-10 16:02:25 +00:00
|
|
|
public function render(): string
|
|
|
|
{
|
2024-05-09 17:55:41 +00:00
|
|
|
$subtitle = $this->subtitle === '' ? '' : '<p class="text-sm text-skin-muted">' . $this->subtitle . '</p>';
|
|
|
|
|
2024-05-12 18:38:33 +00:00
|
|
|
$this->mergeClass('w-full p-4 sm:p-6 md:p-8 bg-elevated border-3 flex flex-col items-start border-subtle rounded-xl');
|
2021-09-10 16:02:25 +00:00
|
|
|
|
|
|
|
return <<<HTML
|
2024-05-09 17:55:41 +00:00
|
|
|
<fieldset {$this->getStringifiedAttributes()}>
|
|
|
|
<x-Heading tagName="legend" class="float-left">{$this->title}</x-Heading>
|
2021-09-10 16:02:25 +00:00
|
|
|
{$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;
|
|
|
|
}
|
|
|
|
}
|