mirror of
https://code.castopod.org/adaures/castopod
synced 2025-04-23 01:01:20 +00:00

- set new colors using the css variables for theming in tailwind.config.js - replace admin and public colors with new variable enabled colors
33 lines
850 B
PHP
33 lines
850 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-accent-base bg-elevated border-contrast border-3 focus:ring-accent w-6 h-6',
|
|
],
|
|
$this->value,
|
|
old($this->name) ? old($this->name) === $this->value : $this->isChecked,
|
|
);
|
|
|
|
return <<<HTML
|
|
<label class="inline-flex items-center {$this->class}">{$radioInput}<span class="ml-2">{$this->slot}</span></label>
|
|
HTML;
|
|
}
|
|
}
|