generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 50
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
24 changed files
with
335 additions
and
56 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
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,26 @@ | ||
<?php | ||
|
||
namespace Workbench\App\View\Components; | ||
|
||
use Closure; | ||
use Illuminate\Contracts\View\View; | ||
use Illuminate\View\Component; | ||
|
||
class Button extends Component | ||
{ | ||
public function __construct(public $type = 'submit', public $variant = 'primary') | ||
{ | ||
// | ||
} | ||
|
||
public function render(): View|Closure|string | ||
{ | ||
return view('components.button', [ | ||
'color' => match ($this->variant) { | ||
'primary' => 'bg-gray-900 text-white', | ||
'secondary' => 'bg-gray-200 text-gray-900', | ||
'danger' => 'bg-red-600 text-white', | ||
}, | ||
]); | ||
} | ||
} |
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,25 @@ | ||
<?php | ||
|
||
namespace Workbench\App\View\Components; | ||
|
||
use Closure; | ||
use Illuminate\Contracts\View\View; | ||
use Illuminate\View\Component; | ||
|
||
class ButtonLink extends Component | ||
{ | ||
public function __construct(public $variant = 'primary', public $icon = null) | ||
{ | ||
// | ||
} | ||
|
||
public function render(): View|Closure|string | ||
{ | ||
return view('components.button-link', [ | ||
'color' => match ($this->variant) { | ||
'primary' => 'bg-gray-900 text-white', | ||
'secondary' => 'bg-gray-200 text-gray-900', | ||
}, | ||
]); | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
|
||
namespace Workbench\App\View\Components; | ||
|
||
use Closure; | ||
use Illuminate\Contracts\View\View; | ||
use Illuminate\View\Component; | ||
|
||
class Icon extends Component | ||
{ | ||
public function __construct(public $type) | ||
{ | ||
// | ||
} | ||
|
||
public function render(): View|Closure|string | ||
{ | ||
return view('components.icon'); | ||
} | ||
} |
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,19 @@ | ||
<?php | ||
|
||
namespace Workbench\App\View\Components; | ||
|
||
use Closure; | ||
use Illuminate\Contracts\View\View; | ||
use Illuminate\View\Component; | ||
|
||
class Modal extends Component | ||
{ | ||
public function __construct(public $minHeight = '', public bool $closable = true) | ||
{ | ||
} | ||
|
||
public function render(): View|Closure|string | ||
{ | ||
return view('components.modal'); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,14 +1,25 @@ | ||
<x-turbo-frame :id="$article" class="contents"> | ||
<h2 class="text-4xl font-semibold">{{ $article->title }}</h2> | ||
<x-turbo-frame :id="$article" class="block relative"> | ||
<div class="absolute right-0 top-0 flex items-center justify-end space-x-4"> | ||
<a href="{{ route('articles.edit', $article) }}" class="opacity-50 transition transform hover:opacity-100" title="{{ __('Edit Article') }}"> | ||
<x-icon type="pencil" /> | ||
<span class="sr-only">{{ __('Edit') }}</span> | ||
</a> | ||
|
||
<p class="prose">{{ $article->content }}</p> | ||
<a | ||
data-turbo-frame="{{ dom_id($article, 'remove_modal_frame') }}" | ||
data-controller="modal-trigger" | ||
data-modal-trigger-modal-outlet="#{{ dom_id($article, 'remove_modal') }}" | ||
data-action="modal-trigger#toggle" | ||
href="{{ route('articles.delete', $article) }}" | ||
class="opacity-50 transition transform hover:opacity-100" | ||
title="{{ __('Edit Article') }}" | ||
> | ||
<x-icon type="trash" /> | ||
<span class="sr-only">{{ __('Trash') }}</span> | ||
</a> | ||
</div> | ||
|
||
<div class="mt-4 border-t pt-2"> | ||
<h4 class="text-2xl">{{ __('Actions') }}</h4> | ||
<h2 class="text-4xl font-semibold">{{ $article->title }}</h2> | ||
|
||
<ul class="flex items-center space-x-2"> | ||
<li><a class="underline text-indigo-600" href="{{ route('articles.edit', $article) }}">{{ __('Edit') }}</a></li> | ||
<li><a class="underline text-red-600" href="{{ route('articles.delete', $article) }}">{{ __('Delete') }}</a></li> | ||
</ul> | ||
</div> | ||
<p class="mt-4 prose">{{ $article->content }}</p> | ||
</x-turbo-frame> |
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,7 +1,7 @@ | ||
<div id="@domid($article, 'card')" class="p-4"> | ||
<p class="mb-2 flex items-center justify-between">{{ $article->title }}</p> | ||
<div id="@domid($article, 'card')" class="p-4 relative"> | ||
<p class="mb-2 text-lg font-semibold flex items-center justify-between"> | ||
<a href="{{ route('articles.show', $article) }}">{{ $article->title }} <span class="absolute inset-0"></span></a> | ||
</p> | ||
|
||
<span class="pt-2 border-t text-sm"> | ||
<a class="underline text-indigo-500" href="{{ route('articles.show', $article)}}">{{ __('View') }}</a> | ||
</span> | ||
<p class="text-sm">{{ str($article->content)->limit(50) }}</p> | ||
</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
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,15 +1,17 @@ | ||
<x-app-layout> | ||
<x-slot name="title">{{ __('New Article') }}</x-slot> | ||
|
||
<h1 class="mb-4 text-4xl font-semibold font-cursive">{{ __('New Article') }}</h1> | ||
<div class="flex items-center space-x-4"> | ||
@unlessturbonative | ||
<x-button-link variant="secondary" href="{{ route('articles.index') }}" icon="arrow-uturn-left"> | ||
<span>{{ __('Index') }}</span> | ||
</x-button-link> | ||
@endturbonative | ||
|
||
<div class="p-6"> | ||
<a class="underline text-indigo-600" href="{{ route('articles.index') }}">{{ __('Back to Index') }}</a> | ||
<h1 class="my-4 text-4xl font-semibold font-cursive">{{ __('New Article') }}</h1> | ||
</div> | ||
|
||
<br> | ||
|
||
<x-turbo-frame id="create_article"> | ||
<x-turbo-frame id="create_article" class="block mt-6 rounded p-6 border shadow-sm"> | ||
@include('articles._form', ['article' => null]) | ||
</x-turbo-frame> | ||
</x-app-layout> |
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 |
---|---|---|
@@ -1,11 +1,25 @@ | ||
<x-app-layout> | ||
<x-slot name="title">{{ __('Articles') }}</x-slot> | ||
|
||
<h1 class="mb-4 text-4xl font-semibold font-sans">{{ __('Articles Index') }}</h1> | ||
<h1 class="my-4 text-4xl font-semibold font-sans">{{ __('Articles Index') }}</h1> | ||
|
||
@include('articles._create_article_link') | ||
<div class="flex items-center justify-end"> | ||
<x-button-link | ||
data-controller="modal-trigger" | ||
data-modal-trigger-modal-outlet="#create-article-modal" | ||
data-action="modal-trigger#toggle" | ||
href="{{ route('articles.create') }}" | ||
data-turbo-frame="create_article" | ||
>{{ __('Add Article') }}</x-button-link> | ||
</div> | ||
|
||
<div id="articles" class="mt-4 flex flex-col space-y-2 divide-y border rounded"> | ||
@each('articles._article_card', $articles, 'article') | ||
</div> | ||
|
||
<x-modal id="create-article-modal" min-height="min-h-[30vh]"> | ||
<x-turbo-frame class="mt-2" id="create_article" loading="lazy"> | ||
<p class="text-gray-600">{{ __('Loading...') }}</p> | ||
</x-turbo-frame> | ||
</x-modal> | ||
</x-app-layout> |
Oops, something went wrong.