-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Showing
26 changed files
with
380 additions
and
165 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
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,22 @@ | ||
@foreach($components as $fieldOrDecoration) | ||
@if($container ?? false) <div class="{{ $containerClass ?? '' }}"> @endif | ||
|
||
@if($fieldOrDecoration instanceof \Leeto\MoonShine\Decorations\Decoration) | ||
{{ $resource->renderDecoration($fieldOrDecoration, $item) }} | ||
@elseif($fieldOrDecoration instanceof \Leeto\MoonShine\Fields\Field | ||
&& $fieldOrDecoration->canDisplayOnForm($item) | ||
&& !$fieldOrDecoration->isResourceModeField() | ||
) | ||
@if($fieldOrDecoration->hasFieldContainer()) | ||
<x-moonshine::field-container :field="$fieldOrDecoration" :item="$item" :resource="$resource"> | ||
{{ $resource->renderField($fieldOrDecoration, $item) }} | ||
</x-moonshine::field-container> | ||
@else | ||
<div class="p-8"> | ||
{{ $resource->renderField($fieldOrDecoration, $item) }} | ||
</div> | ||
@endif | ||
@endif | ||
|
||
@if($container ?? false) </div> @endif | ||
@endforeach |
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,7 @@ | ||
<div class="bg-white dark:bg-darkblue shadow-md rounded-lg mb-4 text-white"> | ||
<x-moonshine::resource-renderable | ||
:components="$decoration->fields()" | ||
:item="$item" | ||
:resource="$resource" | ||
/> | ||
</div> |
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,9 @@ | ||
<div class="px-10 py-5"> | ||
@include('moonshine::shared.btn', [ | ||
'href' => $decoration->getLinkValue(), | ||
'target' => $decoration->isLinkBlank() ? '_blank' : '_self', | ||
'filled' => true, | ||
'icon' => $decoration->iconValue(), | ||
'title' => $decoration->getLinkName() | ||
]) | ||
</div> |
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,12 @@ | ||
<div class="flex | ||
@if(!$decoration->isWithoutSpace()) space-x-4 @endif | ||
items-{{ $decoration->getItemsAlign() }} | ||
justify-{{ $decoration->getJustifyAlign() }}" | ||
> | ||
<x-moonshine::resource-renderable | ||
:components="$decoration->fields()" | ||
:item="$item" | ||
:resource="$resource" | ||
:container="true" | ||
/> | ||
</div> |
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
@if($decoration->tabs()->isNotEmpty()) | ||
<div x-data="{activeTab_{{ $decoration->id() }}: '{{ $decoration->tabs()->first()?->id() }}'}"> | ||
<div> | ||
<nav class="flex flex-col sm:flex-row"> | ||
@foreach($decoration->tabs() as $tab) | ||
<button | ||
:class="{ 'border-b-2 font-medium border-purple': activeTab_{{ $decoration->id() }} === '{{ $tab->id() }}' }" | ||
@click.prevent="activeTab_{{ $decoration->id() }} = '{{ $tab->id() }}'" | ||
class="py-4 px-6 block focus:outline-none text-purple"> | ||
{{ $tab->label() }} | ||
</button> | ||
@endforeach | ||
</nav> | ||
</div> | ||
|
||
@foreach($decoration->tabs() as $tab) | ||
<div x-show="activeTab_{{ $decoration->id() }} === '{{ $tab->id() }}'"> | ||
<x-moonshine::resource-renderable | ||
:components="$tab->fields()" | ||
:item="$item" | ||
:resource="$resource" | ||
/> | ||
</div> | ||
@endforeach | ||
</div> | ||
@endif |
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
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,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Leeto\MoonShine\Decorations; | ||
|
||
class Block extends Decoration | ||
{ | ||
public static string $view = 'moonshine::decorations.block'; | ||
} |
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,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Leeto\MoonShine\Decorations; | ||
|
||
use Leeto\MoonShine\Traits\Fields\LinkTrait; | ||
use Leeto\MoonShine\Traits\WithIcon; | ||
|
||
class Button extends Decoration | ||
{ | ||
use WithIcon; | ||
use LinkTrait; | ||
|
||
public static string $view = 'moonshine::decorations.button'; | ||
|
||
public function __construct(string $label, string $link, bool $blank = false) | ||
{ | ||
$this->setLabel($label); | ||
$this->addLink($label, $link, $blank); | ||
} | ||
} |
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,52 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Leeto\MoonShine\Decorations; | ||
|
||
class Flex extends Decoration | ||
{ | ||
public static string $view = 'moonshine::decorations.flex'; | ||
|
||
protected string $itemsAlign = 'start'; | ||
|
||
protected string $justifyAlign = 'between'; | ||
|
||
protected bool $withoutSpace = false; | ||
|
||
public function withoutSpace(): self | ||
{ | ||
$this->withoutSpace = true; | ||
|
||
return $this; | ||
} | ||
|
||
public function isWithoutSpace(): bool | ||
{ | ||
return $this->withoutSpace; | ||
} | ||
|
||
public function itemsAlign(string $itemsAlign): self | ||
{ | ||
$this->itemsAlign = $itemsAlign; | ||
|
||
return $this; | ||
} | ||
|
||
public function justifyAlign(string $justifyAlign): self | ||
{ | ||
$this->justifyAlign = $justifyAlign; | ||
|
||
return $this; | ||
} | ||
|
||
public function getItemsAlign(): string | ||
{ | ||
return $this->itemsAlign; | ||
} | ||
|
||
public function getJustifyAlign(): string | ||
{ | ||
return $this->justifyAlign; | ||
} | ||
} |
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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Leeto\MoonShine\Decorations; | ||
|
||
use Illuminate\Support\Collection; | ||
use Leeto\MoonShine\Exceptions\DecorationException; | ||
use Throwable; | ||
|
||
class Tabs extends Decoration | ||
{ | ||
public static string $view = 'moonshine::decorations.tabs'; | ||
|
||
public function __construct(protected array $tabs = []) | ||
{ | ||
$this->setLabel(uniqid()); | ||
} | ||
|
||
/** | ||
* @return Collection<Tab> | ||
* @throws Throwable | ||
*/ | ||
public function tabs(): Collection | ||
{ | ||
return tap(Collection::make($this->tabs), function (Collection $tabs) { | ||
throw_if( | ||
$tabs->every(fn($tab) => !$tab instanceof Tab), | ||
new DecorationException('Tabs must be a class of '.Tab::class) | ||
); | ||
}); | ||
} | ||
} |
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
Oops, something went wrong.