[frontend] Add ScrollEnd Component
This commit is contained in:
parent
b060a12789
commit
b423228077
1 changed files with 20 additions and 0 deletions
20
Iceshrimp.Frontend/Components/ScrollEnd.razor
Normal file
20
Iceshrimp.Frontend/Components/ScrollEnd.razor
Normal file
|
@ -0,0 +1,20 @@
|
|||
@using Ljbc1994.Blazor.IntersectionObserver.API
|
||||
@using Ljbc1994.Blazor.IntersectionObserver.Components
|
||||
|
||||
<IntersectionObserve OnChange="entry => OnChange(entry)">
|
||||
<div @ref="context.Ref.Current" class="@Class"><button @onclick="ManualLoad">Load More</button></div>
|
||||
</IntersectionObserve>
|
||||
|
||||
@code {
|
||||
[Parameter, EditorRequired] public EventCallback IntersectionChange { get; set; }
|
||||
[Parameter, EditorRequired] public EventCallback ManualLoad { get; set; }
|
||||
[Parameter] public string? Class { get; set; }
|
||||
|
||||
private async Task OnChange(IntersectionObserverEntry entry)
|
||||
{
|
||||
if (entry.IsIntersecting)
|
||||
{
|
||||
await IntersectionChange.InvokeAsync();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue