From 83e5e90ac21cbd87f1aac82359b7b0f94089a5dc Mon Sep 17 00:00:00 2001 From: Irineu Junior Date: Tue, 26 Mar 2024 15:13:36 -0300 Subject: [PATCH] feat(ui) atualiza o toggle --- src/View/Components/Forms/Inputs/Toggle.php | 88 +++++++++++-------- .../Forms/Inputs/ToggleNotification.php | 60 ------------- src/View/Components/Forms/Inputs/__Toggle.php | 58 ------------ 3 files changed, 51 insertions(+), 155 deletions(-) delete mode 100644 src/View/Components/Forms/Inputs/ToggleNotification.php delete 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 46d1fd6..a4b9fc6 100644 --- a/src/View/Components/Forms/Inputs/Toggle.php +++ b/src/View/Components/Forms/Inputs/Toggle.php @@ -15,6 +15,8 @@ public function __construct( public string $hint = '', public string $labelOn = '', public string $labelOff = '', + public bool $large = false, + public bool $single = false, ) { $this->uuid = '-' . str(serialize($this)) ->pipe('md5') @@ -24,44 +26,56 @@ 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($single) + + @else + + @endif HTML; diff --git a/src/View/Components/Forms/Inputs/ToggleNotification.php b/src/View/Components/Forms/Inputs/ToggleNotification.php deleted file mode 100644 index 1901f50..0000000 --- a/src/View/Components/Forms/Inputs/ToggleNotification.php +++ /dev/null @@ -1,60 +0,0 @@ -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; - } -} diff --git a/src/View/Components/Forms/Inputs/__Toggle.php b/src/View/Components/Forms/Inputs/__Toggle.php deleted file mode 100644 index e965a95..0000000 --- a/src/View/Components/Forms/Inputs/__Toggle.php +++ /dev/null @@ -1,58 +0,0 @@ -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; - } -}