Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:(LAR-180) ajout des reaction et scroll sur article #312

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat:(LAR-180) ajout des reaction et scroll sur article
feat:(LAR-180)  ajout des reactions et scroll sur article
  • Loading branch information
StevyMarlino committed Jan 8, 2025
commit f5b692c710ad774f0866661ebceac5c06aa942b5
8 changes: 5 additions & 3 deletions app/Livewire/Pages/Articles/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@

use App\Models\Article;
use App\Models\Tag;
use App\Traits\WithInfiniteScroll;
use App\Traits\WithLocale;
use Illuminate\Contracts\View\View;
use Livewire\Component;
use Livewire\WithoutUrlPagination;
use Livewire\WithPagination;

final class Index extends Component
{
use WithInfiniteScroll;
use WithLocale;
use WithoutUrlPagination;
use WithPagination;

public function mount(): void
{
Expand All @@ -31,7 +33,7 @@ public function render(): View
->published()
->notPinned()
->forLocale($this->locale)
->paginate($this->perPage),
->simplePaginate(5),
StevyMarlino marked this conversation as resolved.
Show resolved Hide resolved
'tags' => Tag::query()->whereHas('articles', function ($query): void {
$query->published();
})->orderBy('name')->get(),
Expand Down
9 changes: 3 additions & 6 deletions resources/views/livewire/pages/articles/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,8 @@ class="flex size-8 items-center justify-center rounded-full text-gray-400 transi
@endforeach
</div>

@if ($articles->hasMorePages())
<p x-intersect="@this.call('loadMore')" class="mt-10 flex items-center justify-center gap-2">
<x-loader class="text-primary-600" aria-hidden="true" />
{{ __('global.loading') }}
</p>
@endif
<div class="mt-4">
{{ $articles->links() }}
</div>
</x-container>
</div>
11 changes: 10 additions & 1 deletion resources/views/livewire/pages/articles/single-post.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,21 @@ class="object-cover size-full"
</div>

<div class="lg:grid lg:grid-cols-4 lg:gap-16">
<div class="overflow-x-hidden lg:col-span-3">
<div class="overflow-hidden lg:col-span-3">
<x-markdown-content
id="content"
class="prose prose-green text-gray-500 dark:text-gray-400 dark:prose-invert lg:max-w-none"
:content="$article->body"
/>

<div class="relative inline-flex mt-5 space-x-4">
<livewire:components.reactions
wire:key="{{ $article->id }}"
:model="$article"
:with-place-holder="false"
:with-background="false"
/>
</div>
</div>
<div class="hidden lg:block">
<x-sticky-content class="space-y-10">
Expand Down