Skip to content

Commit

Permalink
Add isButton
Browse files Browse the repository at this point in the history
  • Loading branch information
francoism90 committed Jun 20, 2024
1 parent 3d0ed97 commit 21cfbdc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion resources/views/actions/button.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions resources/views/actions/link.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
->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',
])
->mergeAttributes($action->getComponentAttributes())
->classMerge([
'layer',
'button' => $isButton(),
'active' => $isCurrent(),
'inactive' => ! $isCurrent(),
])
Expand Down
6 changes: 6 additions & 0 deletions src/Actions/Components/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -46,4 +47,9 @@ public function isCurrent(): bool

return $this->action->routeIs() || $this->action->fullUrlIs();
}

public function isButton(): bool
{
return boolval($this->button);
}
}

0 comments on commit 21cfbdc

Please sign in to comment.