mirror of
https://code.castopod.org/adaures/castopod.git
synced 2024-09-03 09:27:24 +02:00
- set new colors using the css variables for theming in tailwind.config.js - replace admin and public colors with new variable enabled colors
30 lines
912 B
PHP
30 lines
912 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Views\Components\Forms;
|
|
|
|
class Input extends FormComponent
|
|
{
|
|
protected string $type = 'text';
|
|
|
|
public function render(): string
|
|
{
|
|
$baseClass = 'w-full bg-elevated border-contrast rounded-lg focus:border-contrast border-3 focus:ring-accent focus-within:ring-accent ' . $this->class;
|
|
|
|
$this->attributes['class'] = $baseClass;
|
|
|
|
if ($this->type === 'file') {
|
|
$this->attributes['class'] .= ' file:px-3 file:py-2 file:h-[40px] file:font-semibold file:text-skin-muted file:text-sm file:rounded-none file:border-none file:bg-highlight file:cursor-pointer';
|
|
} else {
|
|
$this->attributes['class'] .= ' px-3 py-2';
|
|
}
|
|
|
|
if ($this->required) {
|
|
$this->attributes['required'] = 'required';
|
|
}
|
|
|
|
return form_input($this->attributes, old($this->name, $this->value));
|
|
}
|
|
}
|