Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
francoism90 committed Apr 23, 2024
1 parent 614f390 commit 5ae6451
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 18 deletions.
2 changes: 2 additions & 0 deletions resources/views/navigation/group.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
->whereDoesntStartWith('wire:model')
}}>
@foreach ($navigation->items() as $item)
{{ $item->state() }}

<x-wireuse::actions-link
:action="$item"
wire:click="$set('{{ $wireModel }}', '{{ $item->getName() }}')"
Expand Down
4 changes: 2 additions & 2 deletions src/Navigation/Components/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Foxws\WireUse\Navigation\Components;

use Closure;
use Foxws\WireUse\Navigation\Support\NavigationGroup;
use Foxws\WireUse\Navigation\Support\Navigation;
use Foxws\WireUse\Views\Concerns\WithLayout;
use Foxws\WireUse\Views\Support\Component;
use Illuminate\View\View;
Expand All @@ -13,7 +13,7 @@ class Group extends Component
use WithLayout;

public function __construct(
public NavigationGroup $navigation,
public Navigation $navigation,
) {
}

Expand Down
15 changes: 12 additions & 3 deletions src/Navigation/Concerns/WithNavigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@

namespace Foxws\WireUse\Navigation\Concerns;

use Foxws\WireUse\Navigation\Support\NavigationGroup;
use Foxws\WireUse\Navigation\Support\Navigation;

trait WithNavigation
{
public function navigation(): NavigationGroup
public Navigation $navigation;

public function mountWithNavigation(): void
{
$this->navigation->fill([
'schema' => $this->navigation(),
]);
}

public function navigation(): array
{
return NavigationGroup::make();
return [];
}
}
4 changes: 2 additions & 2 deletions src/Navigation/Contracts/HasNavigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Foxws\WireUse\Navigation\Contracts;

use Foxws\WireUse\Navigation\Support\NavigationGroup;
use Foxws\WireUse\Navigation\Support\Navigation;

interface HasNavigation
{
public function navigation(): NavigationGroup;
// public function navigation(): array;
}
10 changes: 10 additions & 0 deletions src/Navigation/Support/Navigation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Foxws\WireUse\Navigation\Support;

use Foxws\WireUse\Support\Livewire\StateObjects\State;

class Navigation extends State
{
public $schema = [];
}
10 changes: 0 additions & 10 deletions src/Navigation/Support/NavigationGroup.php

This file was deleted.

13 changes: 12 additions & 1 deletion src/Support/Components/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,21 @@
use Illuminate\Support\Fluent;
use Illuminate\Support\Traits\Conditionable;
use Illuminate\Support\Traits\Tappable;
use Livewire\Wireable;

abstract class Component extends Fluent
abstract class Component extends Fluent implements Wireable
{
use Conditionable;
use Tappable;
use WithHash;

public function toLivewire(): array
{
return $this->toArray();
}

public static function fromLivewire($value): static
{
return new static($value);
}
}

0 comments on commit 5ae6451

Please sign in to comment.