Neighbourhood.omg.lol/Components/RefreshButton.razor

18 lines
No EOL
578 B
Text

@inject State State
<button id="refreshButton" class="absolute transparent circle top right margin" @onclick="() => State.SendRefresh()">
<i class="fa-solid fa-arrow-rotate-right @(State.IsRefreshing ? "fa-spin" : "")"></i>
</button>
@code {
protected override async Task OnInitializedAsync() {
await base.OnInitializedAsync();
State.PropertyChanged += StateChanged;
}
private async void StateChanged(object? sender, PropertyChangedEventArgs e) {
if (e.PropertyName == nameof(State.IsRefreshing)) {
await InvokeAsync(StateHasChanged);
}
}
}