Neighbourhood.omg.lol/Components/RefreshButton.razor

18 lines
578 B
Text
Raw Normal View History

@inject State State
2024-06-24 04:52:45 +00:00
<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);
}
}
}