From dad79c7848bd2478323e90b190808b9a63a987f7 Mon Sep 17 00:00:00 2001 From: Tony Messias Date: Thu, 4 Jan 2024 22:38:52 -0300 Subject: [PATCH] Adds a refresh-method and refresh-scroll components --- resources/views/components/refresh-method.blade.php | 8 ++++++++ resources/views/components/refresh-scroll.blade.php | 7 +++++++ resources/views/components/refreshes-with.blade.php | 9 ++------- 3 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 resources/views/components/refresh-method.blade.php create mode 100644 resources/views/components/refresh-scroll.blade.php diff --git a/resources/views/components/refresh-method.blade.php b/resources/views/components/refresh-method.blade.php new file mode 100644 index 0000000..8afd6a4 --- /dev/null +++ b/resources/views/components/refresh-method.blade.php @@ -0,0 +1,8 @@ +@props(['method' => 'replace']) + +@php + throw_unless(in_array($method, ['replace', 'morph']), HotwiredLaravel\TurboLaravel\Exceptions\PageRefreshStrategyException::invalidRefreshMethod($method)); +@endphp + + + diff --git a/resources/views/components/refresh-scroll.blade.php b/resources/views/components/refresh-scroll.blade.php new file mode 100644 index 0000000..3ae3c7b --- /dev/null +++ b/resources/views/components/refresh-scroll.blade.php @@ -0,0 +1,7 @@ +@props(['scroll' => 'reset']) + +@php + throw_unless(in_array($scroll, ['reset', 'preserve']), HotwiredLaravel\TurboLaravel\Exceptions\PageRefreshStrategyException::invalidRefreshScroll($scroll)); +@endphp + + diff --git a/resources/views/components/refreshes-with.blade.php b/resources/views/components/refreshes-with.blade.php index 6471f07..7f7c79f 100644 --- a/resources/views/components/refreshes-with.blade.php +++ b/resources/views/components/refreshes-with.blade.php @@ -1,9 +1,4 @@ @props(['method' => 'replace', 'scroll' => 'reset']) -@php - throw_unless(in_array($method, ['replace', 'morph']), HotwiredLaravel\TurboLaravel\Exceptions\PageRefreshStrategyException::invalidRefreshMethod($method)); - throw_unless(in_array($scroll, ['reset', 'preserve']), HotwiredLaravel\TurboLaravel\Exceptions\PageRefreshStrategyException::invalidRefreshScroll($scroll)); -@endphp - - - + +