mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
paginate news
This commit is contained in:
@@ -13,12 +13,19 @@ class ArticleOverview extends Component
|
|||||||
use Actions;
|
use Actions;
|
||||||
use NostrTrait;
|
use NostrTrait;
|
||||||
|
|
||||||
|
public $perPage = 9;
|
||||||
|
|
||||||
public array $filters = [];
|
public array $filters = [];
|
||||||
|
|
||||||
protected $queryString = [
|
protected $queryString = [
|
||||||
'filters' => ['except' => ''],
|
'filters' => ['except' => ''],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function loadMore()
|
||||||
|
{
|
||||||
|
$this->perPage += 9;
|
||||||
|
}
|
||||||
|
|
||||||
public function nostr($id)
|
public function nostr($id)
|
||||||
{
|
{
|
||||||
$libraryItem = LibraryItem::query()
|
$libraryItem = LibraryItem::query()
|
||||||
@@ -84,7 +91,7 @@ class ArticleOverview extends Component
|
|||||||
->where('type', 'markdown_article')
|
->where('type', 'markdown_article')
|
||||||
->where('news', true)
|
->where('news', true)
|
||||||
->orderByDesc('created_at')
|
->orderByDesc('created_at')
|
||||||
->get(),
|
->paginate($this->perPage),
|
||||||
])->layout('layouts.app', [
|
])->layout('layouts.app', [
|
||||||
'SEOData' => new SEOData(
|
'SEOData' => new SEOData(
|
||||||
title: __('News'),
|
title: __('News'),
|
||||||
|
|||||||
@@ -173,6 +173,24 @@
|
|||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
|
<div
|
||||||
|
x-data="{
|
||||||
|
observe () {
|
||||||
|
let observer = new IntersectionObserver((entries) => {
|
||||||
|
entries.forEach(entry => {
|
||||||
|
if (entry.isIntersecting) {
|
||||||
|
@this.call('loadMore')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, {
|
||||||
|
root: null
|
||||||
|
})
|
||||||
|
observer.observe(this.$el)
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
x-init="observe"
|
||||||
|
></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user