From 79bef5c2d8da11f0ae48f138ba5b6d19c3e1a20f Mon Sep 17 00:00:00 2001 From: Caleb Porzio Date: Wed, 2 Sep 2020 02:20:39 -0400 Subject: [PATCH 1/6] Refactor modals --- .../components/confirmation-modal.blade.php | 4 ++-- .../views/components/dialog-modal.blade.php | 4 ++-- resources/views/components/modal.blade.php | 20 ++++++------------- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/resources/views/components/confirmation-modal.blade.php b/resources/views/components/confirmation-modal.blade.php index 0d1dfffc2..f8fb9ad13 100644 --- a/resources/views/components/confirmation-modal.blade.php +++ b/resources/views/components/confirmation-modal.blade.php @@ -1,6 +1,6 @@ -@props(['id' => null, 'show', 'maxWidth']) +@props(['id' => null, 'maxWidth' => null]) - +
diff --git a/resources/views/components/dialog-modal.blade.php b/resources/views/components/dialog-modal.blade.php index 5b2a77953..1f975ad31 100644 --- a/resources/views/components/dialog-modal.blade.php +++ b/resources/views/components/dialog-modal.blade.php @@ -1,6 +1,6 @@ -@props(['show', 'maxWidth']) +@props(['id' => null, 'maxWidth' => null]) - +
{{ $title }} diff --git a/resources/views/components/modal.blade.php b/resources/views/components/modal.blade.php index 163bc8ac0..8173deda3 100644 --- a/resources/views/components/modal.blade.php +++ b/resources/views/components/modal.blade.php @@ -1,15 +1,7 @@ -@props(['id' => null, 'show', 'maxWidth']) +@props(['id', 'maxWidth']) @php -if (is_null($id)) { - $id = md5($show); -} - -if (is_bool($_instance->{$show})) { - $shouldShow = $_instance->{$show}; -} else { - $shouldShow = ! is_null($_instance->{$show}); -} +$id = $id ?? md5($attributes->wire('model')); switch ($maxWidth ?? '2xl') { case 'sm': @@ -31,13 +23,13 @@ } @endphp -