From 1c92e1a2e2bedbad2adc03f382e568891e8a3521 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Mon, 4 Nov 2024 23:55:44 +0100 Subject: [PATCH] Add error handling via tooltip --- app/View/Form/Select.php | 1 + app/View/Form/Text.php | 1 + app/View/Ui/Errors.php | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 app/View/Ui/Errors.php diff --git a/app/View/Form/Select.php b/app/View/Form/Select.php index 89db5bfd..45317eaf 100644 --- a/app/View/Form/Select.php +++ b/app/View/Form/Select.php @@ -47,6 +47,7 @@ class Select extends Component @endforeach + @if($hint) {{$hint}} @endif diff --git a/app/View/Form/Text.php b/app/View/Form/Text.php index 6a723534..3cacb3ad 100644 --- a/app/View/Form/Text.php +++ b/app/View/Form/Text.php @@ -44,6 +44,7 @@ class Text extends Component " {{ $attributes }} /> + @if($hint) {{$hint}} @endif diff --git a/app/View/Ui/Errors.php b/app/View/Ui/Errors.php new file mode 100644 index 00000000..998e9ba4 --- /dev/null +++ b/app/View/Ui/Errors.php @@ -0,0 +1,33 @@ +for); + } + + public function render() + { + return <<<'HTML' + @error($for) +
+
+
{{$message}}
+
+
+
+ @enderror + HTML; + } +}