From 1fc8f4f80249a79924fd2d51b5b82285128efa9a Mon Sep 17 00:00:00 2001 From: Annika Backstrom Date: Sat, 25 May 2024 23:28:35 +0100 Subject: [PATCH] Switch to livewire views --- app/Livewire/Bookmark.php | 16 ++++ app/View/Components/Bookmark.php | 28 ------- composer.json | 3 +- composer.lock | 78 ++++++++++++++++++- resources/sass/app.scss | 13 ++++ resources/sass/components/_bookmark.scss | 12 +++ resources/views/bookmarks/index.blade.php | 2 +- resources/views/bookmarks/show.blade.php | 5 +- .../bookmark.blade.php | 7 +- routes/web.php | 8 +- 10 files changed, 137 insertions(+), 35 deletions(-) create mode 100644 app/Livewire/Bookmark.php delete mode 100644 app/View/Components/Bookmark.php rename resources/views/{components => livewire}/bookmark.blade.php (78%) diff --git a/app/Livewire/Bookmark.php b/app/Livewire/Bookmark.php new file mode 100644 index 0000000..f2e9174 --- /dev/null +++ b/app/Livewire/Bookmark.php @@ -0,0 +1,16 @@ +bookmark = $bookmark; + } +} diff --git a/app/View/Components/Bookmark.php b/app/View/Components/Bookmark.php deleted file mode 100644 index 271cea1..0000000 --- a/app/View/Components/Bookmark.php +++ /dev/null @@ -1,28 +0,0 @@ -links() }} @foreach ($bookmarks as $bookmark) - + @endforeach {{ $bookmarks->links() }} diff --git a/resources/views/bookmarks/show.blade.php b/resources/views/bookmarks/show.blade.php index 605ec9d..9f86dae 100644 --- a/resources/views/bookmarks/show.blade.php +++ b/resources/views/bookmarks/show.blade.php @@ -1,5 +1,8 @@ @extends('layouts.app') @section('content') - +

+ ← Back +

+ @endsection diff --git a/resources/views/components/bookmark.blade.php b/resources/views/livewire/bookmark.blade.php similarity index 78% rename from resources/views/components/bookmark.blade.php rename to resources/views/livewire/bookmark.blade.php index eaa31e4..4956fa4 100644 --- a/resources/views/components/bookmark.blade.php +++ b/resources/views/livewire/bookmark.blade.php @@ -1,5 +1,10 @@
-

{{ $bookmark->title }}

+

+ {{ $bookmark->title }} + @action('index') + # + @endaction +

{{ $bookmark->href }}

@if (!empty($bookmark->description))
diff --git a/routes/web.php b/routes/web.php index 668451c..7cd0725 100644 --- a/routes/web.php +++ b/routes/web.php @@ -3,5 +3,9 @@ use App\Http\Controllers\BookmarkController; use Illuminate\Support\Facades\Route; -Route::get('/', [BookmarkController::class, 'index']); -Route::resource('bookmarks', BookmarkController::class)->except(['index']); +Route::get( + '/', function () { + return redirect()->action([BookmarkController::class, 'index']); + } +); +Route::resource('bookmarks', BookmarkController::class);