[frontend] VirtualScroller: CSS and layout fixes
This commit is contained in:
parent
54ff8efa1f
commit
7181f9301b
2 changed files with 18 additions and 10 deletions
|
@ -29,7 +29,12 @@
|
|||
Loading!
|
||||
</div>
|
||||
}
|
||||
<div @ref="@_padBotRef" class="padding bottom" style="height: @(State.PadBottom + "px")"></div>
|
||||
else
|
||||
{
|
||||
<div class="target"><span>The end!<button @onclick="Down">Load more!</button></span></div>
|
||||
}
|
||||
<div @ref="@_padBotRef" class="padding bottom" style="height: @(State.PadBottom + "px")">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
@ -77,7 +82,7 @@
|
|||
loadingBottom = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
||||
private async Task LoadNewer()
|
||||
{
|
||||
_loadingTop = true;
|
||||
|
@ -99,7 +104,7 @@
|
|||
for (int i = 0; i < amount; i++)
|
||||
{
|
||||
var height = await Module.InvokeAsync<int>("GetHeight", _refs[i]);
|
||||
State.PadTop += height;
|
||||
State.PadTop += height;
|
||||
State.Height[State.RenderedList[i].Id] = height;
|
||||
}
|
||||
|
||||
|
@ -147,7 +152,7 @@
|
|||
for (int i = 0; i < UpdateCount; i++)
|
||||
{
|
||||
var height = await Module.InvokeAsync<int>("GetHeight", _refs[i]);
|
||||
State.PadBottom += height;
|
||||
State.PadBottom += height;
|
||||
State.Height[State.RenderedList[i].Id] = height;
|
||||
}
|
||||
|
||||
|
@ -170,10 +175,7 @@
|
|||
private async Task SetupObservers()
|
||||
{
|
||||
// Enabling root margin causes erratic virtual scroller behavior, i've not figured out why
|
||||
var options = new IntersectionObserverOptions
|
||||
{
|
||||
RootMargin = "100%"
|
||||
};
|
||||
var options = new IntersectionObserverOptions { RootMargin = "100%" };
|
||||
OvrscrlObsvTop = await ObserverService.Create(OverscrollCallbackTop);
|
||||
OvrscrlObsvBottom = await ObserverService.Create(OverscrollCallbackBottom);
|
||||
|
||||
|
@ -236,7 +238,7 @@
|
|||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
var virtualScrollerState = StateService.VirtualScroller.GetState("home");
|
||||
State = virtualScrollerState;
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
.padding {
|
||||
width: 1px;
|
||||
min-height: 1px;
|
||||
}
|
||||
.bottom {
|
||||
min-height: 1rem;
|
||||
@media (max-width: 1000px){
|
||||
min-height: 5rem;
|
||||
}
|
||||
}
|
||||
.scroller {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-y: scroll;
|
||||
overflow-x: clip;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
|
|
Loading…
Add table
Reference in a new issue