From 2be8336c47088921de80d339f852e2cf224d3c2c Mon Sep 17 00:00:00 2001 From: Irineu Junior Date: Tue, 26 Mar 2024 10:27:48 -0300 Subject: [PATCH] wip(profile) wip --- src/View/Components/Forms/Inputs/Toggle.php | 54 ++++++++++------- src/View/Components/Forms/Inputs/__Toggle.php | 59 +++++++++++++++++++ 2 files changed, 92 insertions(+), 21 deletions(-) create mode 100644 src/View/Components/Forms/Inputs/__Toggle.php diff --git a/src/View/Components/Forms/Inputs/Toggle.php b/src/View/Components/Forms/Inputs/Toggle.php index e965a95..0c6a27b 100644 --- a/src/View/Components/Forms/Inputs/Toggle.php +++ b/src/View/Components/Forms/Inputs/Toggle.php @@ -13,8 +13,8 @@ public function __construct( public string $name = '', public string $label = '', public string $hint = '', - public string $inline = '', - public array $values = [], + public string $labelOn = '', + public string $labelOff = '', ) { $this->uuid = '-' . str(serialize($this)) ->pipe('md5') @@ -24,33 +24,45 @@ public function __construct( public function render(): string|View { +// $classCollection = Str::of($attributes->get('class'))->explode(' '); +// $labelClass = $classCollection->filter(function (string $value, string $key) { +// return Str::of($value)->startsWith('form-switch'); +// })->values(); +// $inputClass = $classCollection->filter(function (string $value, string $key) { +// return !Str::of($value)->startsWith('form-switch'); +// })->values(); +// + + return <<<'HTML' - @if($label) - $attributes->has('required')])> - {{ str($label)->lower()->ucfirst() }} - - @endif - @foreach($values as $key => $value) - HTML; diff --git a/src/View/Components/Forms/Inputs/__Toggle.php b/src/View/Components/Forms/Inputs/__Toggle.php new file mode 100644 index 0000000..441d8d5 --- /dev/null +++ b/src/View/Components/Forms/Inputs/__Toggle.php @@ -0,0 +1,59 @@ +uuid = '-' . str(serialize($this)) + ->pipe('md5') + ->limit(5, '') + ->toString(); + } + + public function render(): string|View + { + return <<<'HTML' + @if($label) + $attributes->has('required')])> + {{ str($label)->lower()->ucfirst() }} + + @endif + @foreach($values as $key => $value) + + @endforeach + + + HTML; + } +}