generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c3fca1
commit dc785e9
Showing
13 changed files
with
194 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
<button {{ $attributes | ||
->cssClass([ | ||
'layer' => 'inline-flex shrink-0 cursor-pointer select-none items-center', | ||
'disabled' => '!bg-gray-300 pointer-events-none opacity-50', | ||
]) | ||
->classMerge([ | ||
'layer', | ||
'disabled' => $attributes->has('disabled'), | ||
]) | ||
->merge([ | ||
'type' => 'button', | ||
]) | ||
}}> | ||
{{ $label }} | ||
|
||
{{ $slot }} | ||
</button> | ||
<a | ||
@if ($navigate()) wire:navigate @endif | ||
{{ $attributes | ||
->cssClass([ | ||
'layer' => 'inline-flex shrink-0 cursor-pointer items-center hover:text-primary-400', | ||
'active' => 'text-primary-400 hover:text-primary-300', | ||
'inactive' => 'text-secondary', | ||
]) | ||
->classMerge([ | ||
'layer', | ||
'active' => $active(), | ||
'inactive' => ! $active(), | ||
]) | ||
->merge([ | ||
'href' => $url(), | ||
'aria-label' => $action->getLabel(), | ||
'title' => $action->getLabel(), | ||
]) | ||
}} | ||
> | ||
@if ($slot->isEmpty()) | ||
{{ $action->getLabel() }} | ||
@else | ||
{{ $slot }} | ||
@endif | ||
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<nav {{ $attributes | ||
->cssClass([ | ||
'layer' => 'flex items-center px-3 gap-5 border-b border-secondary-800/80 overflow-x-auto', | ||
'tab' => 'text-sm font-medium py-3', | ||
'active' => 'text-white border-b border-white-600/80', | ||
'inactive' => 'text-secondary-600', | ||
]) | ||
->classMerge([ | ||
'layer', | ||
]) | ||
->whereDoesntStartWith('wire:model') | ||
}}> | ||
|
||
|
||
@foreach ($navigation->items() as $item) | ||
<x-wireuse::actions-link | ||
:action="$item" | ||
wire:click="$set('{{ $wireModel }}', '{{ $item->getName() }}')" | ||
class="{{ $attributes->classFor('tab') }}" | ||
class:active="{{ $attributes->classFor('active') }}" | ||
class:inactive="{{ $attributes->classFor('inactive') }}" | ||
/> | ||
|
||
|
||
|
||
{{-- <input | ||
type="radio" | ||
value="{{ $item->getName() }}" | ||
id="{{ $item->getName() }}" | ||
class="hidden" | ||
{{ $attributes->whereStartsWith('wire:model') }} | ||
> | ||
<label | ||
{{ $attributes | ||
->classOnly([ | ||
'tab', | ||
'active' => $item->getName() === $this->{$wireModel()}, | ||
]) | ||
->merge([ | ||
'for' => $item->getName() | ||
]) | ||
}} | ||
> | ||
{{ $item->getLabel() }} | ||
</label> --}} | ||
@endforeach | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,34 @@ | ||
<?php | ||
|
||
namespace Foxws\WireUi\Actions\Components; | ||
namespace Foxws\WireUse\Actions\Components; | ||
|
||
use Closure; | ||
use Foxws\WireUse\Actions\Support\Action; | ||
use Foxws\WireUse\Views\Support\Component; | ||
use Illuminate\Contracts\Support\Htmlable; | ||
use Illuminate\View\View; | ||
|
||
class Button extends Component | ||
{ | ||
public function __construct( | ||
public string|Htmlable|null $label = '', | ||
public Action $action, | ||
) { | ||
} | ||
|
||
public function render(): View | ||
public function render(): View|Closure|string | ||
{ | ||
return view('wireui::actions.button'); | ||
return view('wireuse::actions.button'); | ||
} | ||
|
||
public function active(): bool | ||
{ | ||
return $this->action->isActive(); | ||
} | ||
|
||
public function icon(): ?string | ||
{ | ||
return $this->when($this->active(), | ||
fn () => $this->action->getActiveIcon(), | ||
fn () => $this->action->getIcon(), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace Foxws\WireUse\Actions\Concerns; | ||
|
||
use Closure; | ||
use Illuminate\View\Component; | ||
use Livewire\Component as Livewire; | ||
|
||
trait HasComponent | ||
{ | ||
public function component(Component|Livewire|Closure|string $component): static | ||
{ | ||
$this->component = $component; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Foxws\WireUse\Actions\Concerns; | ||
|
||
use Closure; | ||
use Illuminate\View\View; | ||
|
||
trait HasView | ||
{ | ||
public function view(View|Closure|string $view): static | ||
{ | ||
$this->view = $view; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,8 @@ | |
|
||
class Group extends Collection | ||
{ | ||
// | ||
public function items(): array | ||
{ | ||
return $this->all(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Foxws\WireUse\Navigation\Components; | ||
|
||
use Closure; | ||
use Foxws\WireUse\Navigation\Support\NavigationGroup; | ||
use Foxws\WireUse\Views\Concerns\WithLayout; | ||
use Foxws\WireUse\Views\Support\Component; | ||
use Illuminate\View\View; | ||
|
||
class Group extends Component | ||
{ | ||
use WithLayout; | ||
|
||
public function __construct( | ||
public NavigationGroup $navigation, | ||
) { | ||
} | ||
|
||
public function render(): View|Closure|string | ||
{ | ||
return view('wireuse::navigation.group'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Foxws\WireUse\Navigation\Concerns; | ||
|
||
use Foxws\WireUse\Navigation\Support\NavigationGroup; | ||
|
||
trait WithNavigation | ||
{ | ||
public function navigation(): NavigationGroup | ||
{ | ||
return NavigationGroup::make(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Foxws\WireUse\Views\Concerns; | ||
|
||
trait WithLayout | ||
{ | ||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters