From 21cfbdcc13d8d938a9e4d5ae4b0d4fa50fe60550 Mon Sep 17 00:00:00 2001 From: francoism90 Date: Thu, 20 Jun 2024 16:22:26 +0200 Subject: [PATCH] Add isButton --- resources/views/actions/button.blade.php | 2 +- resources/views/actions/link.blade.php | 2 ++ src/Actions/Components/Link.php | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/resources/views/actions/button.blade.php b/resources/views/actions/button.blade.php index 727cdff0..f9e65631 100644 --- a/resources/views/actions/button.blade.php +++ b/resources/views/actions/button.blade.php @@ -2,7 +2,7 @@ ->cssClass([ 'layer' => 'flex shrink-0 cursor-pointer items-center justify-center', 'label' => 'text-inherit', - 'primary' => 'py-1.5 px-3 bg-primary-500 rounded border border-primary-500', + 'primary' => 'py-1.5 px-3 gap-1 bg-primary-500 rounded border border-primary-500', 'active' => 'text-primary-400 hover:text-primary-300', 'inactive' => 'text-secondary-400 hover:text-primary-400', 'icon' => 'size-6 text-secondary-400', diff --git a/resources/views/actions/link.blade.php b/resources/views/actions/link.blade.php index 4915e24a..e6f60453 100644 --- a/resources/views/actions/link.blade.php +++ b/resources/views/actions/link.blade.php @@ -2,6 +2,7 @@ ->cssClass([ 'layer' => 'inline-flex shrink-0 cursor-pointer items-center justify-center', 'label' => 'text-inherit', + 'button' => 'py-1.5 px-3 gap-1 border border-primary-500 no-underline', 'active' => 'text-primary-400 hover:text-primary-300', 'inactive' => 'text-secondary-400 hover:text-primary-400', 'icon' => 'size-6 text-secondary-400', @@ -9,6 +10,7 @@ ->mergeAttributes($action->getComponentAttributes()) ->classMerge([ 'layer', + 'button' => $isButton(), 'active' => $isCurrent(), 'inactive' => ! $isCurrent(), ]) diff --git a/src/Actions/Components/Link.php b/src/Actions/Components/Link.php index 212cbe0e..7cb7f892 100644 --- a/src/Actions/Components/Link.php +++ b/src/Actions/Components/Link.php @@ -12,6 +12,7 @@ class Link extends Component public function __construct( public Action $action, public ?string $active = null, + public ?bool $button = null, ) {} public function render(): View|Closure|string @@ -46,4 +47,9 @@ public function isCurrent(): bool return $this->action->routeIs() || $this->action->fullUrlIs(); } + + public function isButton(): bool + { + return boolval($this->button); + } }