From 1d1401a3d88701e9fd4ca92cb37e9bd92fc9982f Mon Sep 17 00:00:00 2001 From: francoism90 Date: Mon, 8 Jul 2024 15:26:27 +0200 Subject: [PATCH] wip --- src/Support/Html/Mixins/BaseElementMixin.php | 20 ++++++++++---------- src/Support/Html/Mixins/LinkElementMixin.php | 3 ++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Support/Html/Mixins/BaseElementMixin.php b/src/Support/Html/Mixins/BaseElementMixin.php index 4f1f1e5..688707b 100644 --- a/src/Support/Html/Mixins/BaseElementMixin.php +++ b/src/Support/Html/Mixins/BaseElementMixin.php @@ -7,16 +7,16 @@ class BaseElementMixin { - public function wireKey(): mixed + public function navigate(): mixed { - return function (?string $value = null): BaseElement { + return function (): BaseElement { /** @var BaseElement $this */ - return $this->attribute('wire:key', $value); + return $this->attribute('wire:navigate'); }; } - public function wireIgnore(): mixed + public function ignore(): mixed { return function (?bool $self = false): BaseElement { /** @var BaseElement $this */ @@ -27,21 +27,21 @@ public function wireIgnore(): mixed }; } - public function wireNavigate(): mixed + public function submit(): mixed { - return function (): BaseElement { + return function (?string $action = null): BaseElement { /** @var BaseElement $this */ - return $this->attribute('wire:navigate'); + return $this->attribute('wire:submit', $action); }; } - public function wireSubmit(): mixed + public function wireKey(): mixed { - return function (?string $action = null): BaseElement { + return function (?string $value = null): BaseElement { /** @var BaseElement $this */ - return $this->attribute('wire:submit', $action); + return $this->attribute('wire:key', $value); }; } diff --git a/src/Support/Html/Mixins/LinkElementMixin.php b/src/Support/Html/Mixins/LinkElementMixin.php index bb976c4..3953635 100644 --- a/src/Support/Html/Mixins/LinkElementMixin.php +++ b/src/Support/Html/Mixins/LinkElementMixin.php @@ -13,10 +13,11 @@ public function route(): mixed $href = route($route, ...$parameters); return $this + ->navigate() ->href($href) ->class([ 'link', - 'link-active' => request()->routeIs($route) || request()->fullUrlIs($href), + 'link-active' => request()->routeIs($route, "{$route}.*") || request()->fullUrlIs($href), ]); }; }