castopod/app/Views/Components/Forms/Radio.php
Yassine Doghri be5a28787f fix(layouts): replace holy-grail layout with tailwind config + widen public podcast layout
- add rounded classes with conditional border-radius depending on screen width
- add ring-castopod
class to use on focus states
2021-12-29 12:02:51 +00:00

33 lines
804 B
PHP

<?php
declare(strict_types=1);
namespace App\Views\Components\Forms;
class Radio extends FormComponent
{
protected bool $isChecked = false;
public function setIsChecked(string $value): void
{
$this->isChecked = $value === 'true';
}
public function render(): string
{
$radioInput = form_radio(
[
'id' => $this->value,
'name' => $this->name,
'class' => 'text-pine-500 border-black border-3 focus:ring-castopod w-6 h-6',
],
$this->value,
old($this->name) ? old($this->name) === $this->value : $this->isChecked,
);
return <<<HTML
<label class="leading-8">{$radioInput}<span class="ml-2">{$this->slot}</span></label>
HTML;
}
}