From 2bd6a410d99d7e2d96c49bdf560534154af42bef Mon Sep 17 00:00:00 2001 From: rupadana Date: Mon, 2 Oct 2023 15:23:36 +0000 Subject: [PATCH] Fix styling --- src/Components/InputGroup.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Components/InputGroup.php b/src/Components/InputGroup.php index bb880a4..4a57bc1 100644 --- a/src/Components/InputGroup.php +++ b/src/Components/InputGroup.php @@ -2,14 +2,15 @@ namespace Rupadana\FilamentCustomForms\Components; -use Filament\Forms\Components\Concerns\HasLabel; -use Filament\Forms\Components\Grid; use Closure; +use Filament\Forms\Components\Concerns\HasLabel; use Filament\Forms\Components\Field; +use Filament\Forms\Components\Grid; class InputGroup extends Grid { use HasLabel; + protected string $view = 'filament-custom-forms::components.grid'; public static function make(array | int | string | null $columns = 2): static @@ -19,11 +20,10 @@ public static function make(array | int | string | null $columns = 2): static $static->extraAttributes(['class' => 'filament-input-group gap-y-2 grid']); $static->columnSpan(1); - + return $static; } - public function schema(array | Closure $components): static { $this->childComponents($components); @@ -34,7 +34,7 @@ public function schema(array | Closure $components): static public function showChildLabel(bool $condition = true) { - $this->isHideChildLabel = !$condition; + $this->isHideChildLabel = ! $condition; return $this; } @@ -46,12 +46,13 @@ public function getChildComponents(): array { $components = $this->childComponents; - + if ($this->isHideChildLabel) { $components = collect($components)->map(function (Field $component) { if (method_exists($component, 'placeholder')) { $component = $component->placeholder($component->getLabel()); } + return $component->hiddenLabel(); })->toArray(); }