2021-09-10 18:02:25 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace App\Views\Components\Forms;
|
|
|
|
|
|
|
|
class Input extends FormComponent
|
|
|
|
{
|
|
|
|
protected string $type = 'text';
|
|
|
|
|
|
|
|
public function render(): string
|
|
|
|
{
|
2021-10-18 18:44:07 +02:00
|
|
|
$class = 'px-3 py-2 bg-white border-black rounded-lg focus:border-black border-3 focus:ring-castopod ' . $this->class;
|
2021-09-10 18:02:25 +02:00
|
|
|
|
2021-09-15 17:58:21 +02:00
|
|
|
$this->attributes['class'] = $class;
|
2021-09-10 18:02:25 +02:00
|
|
|
|
|
|
|
if ($this->required) {
|
2021-09-15 17:58:21 +02:00
|
|
|
$this->attributes['required'] = 'required';
|
2021-09-10 18:02:25 +02:00
|
|
|
}
|
|
|
|
|
2021-09-15 17:58:21 +02:00
|
|
|
return form_input($this->attributes, old($this->name, $this->value));
|
2021-09-10 18:02:25 +02:00
|
|
|
}
|
|
|
|
}
|