Skip to content

Commit b46c1c1

Browse files
authored
feat:(LAR-180) ajout des réactions et scroll sur article (#312)
2 parents aaf76d4 + 81f3e9f commit b46c1c1

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

app/Livewire/Pages/Articles/Index.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66

77
use App\Models\Article;
88
use App\Models\Tag;
9-
use App\Traits\WithInfiniteScroll;
109
use App\Traits\WithLocale;
1110
use Illuminate\Contracts\View\View;
1211
use Livewire\Component;
12+
use Livewire\WithoutUrlPagination;
13+
use Livewire\WithPagination;
1314

1415
final class Index extends Component
1516
{
16-
use WithInfiniteScroll;
1717
use WithLocale;
18+
use WithoutUrlPagination;
19+
use WithPagination;
1820

1921
public function mount(): void
2022
{
@@ -31,7 +33,7 @@ public function render(): View
3133
->published()
3234
->notPinned()
3335
->forLocale($this->locale)
34-
->paginate($this->perPage),
36+
->simplePaginate(20),
3537
'tags' => Tag::query()->whereHas('articles', function ($query): void {
3638
$query->published();
3739
})->orderBy('name')->get(),

resources/views/livewire/pages/articles/index.blade.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,8 @@ class="flex size-8 items-center justify-center rounded-full text-gray-400 transi
119119
@endforeach
120120
</div>
121121

122-
@if ($articles->hasMorePages())
123-
<p x-intersect="@this.call('loadMore')" class="mt-10 flex items-center justify-center gap-2">
124-
<x-loader class="text-primary-600" aria-hidden="true" />
125-
{{ __('global.loading') }}
126-
</p>
127-
@endif
122+
<div class="mt-4">
123+
{{ $articles->links() }}
124+
</div>
128125
</x-container>
129126
</div>

resources/views/livewire/pages/articles/single-post.blade.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,21 @@ class="object-cover size-full"
108108
</div>
109109

110110
<div class="lg:grid lg:grid-cols-4 lg:gap-16">
111-
<div class="overflow-x-hidden lg:col-span-3">
111+
<div class="overflow-hidden lg:col-span-3">
112112
<x-markdown-content
113113
id="content"
114114
class="prose prose-green text-gray-500 dark:text-gray-400 dark:prose-invert lg:max-w-none"
115115
:content="$article->body"
116116
/>
117+
118+
<div class="relative inline-flex mt-5 space-x-4">
119+
<livewire:components.reactions
120+
wire:key="{{ $article->id }}"
121+
:model="$article"
122+
:with-place-holder="false"
123+
:with-background="false"
124+
/>
125+
</div>
117126
</div>
118127
<div class="hidden lg:block">
119128
<x-sticky-content class="space-y-10">

0 commit comments

Comments
 (0)