feat(Toasts) Adding toasts

This commit is contained in:
2022-04-10 17:32:22 -04:00
parent 8c06fdd120
commit 4322be0053
29 changed files with 478 additions and 100 deletions
+42
View File
@@ -0,0 +1,42 @@
@implements IDisposable;
@inject IToastService toastService
@if (toastService.HasToasts())
{
<div class="toastsContainer">
@foreach (var toast in toastService.GetToasts())
{
<ToastComponent Toast="toast"/>
}
</div>
}
<style>
.toastsContainer {
position: fixed;
top: 64px;
right: 64px;
}
</style>
@code {
protected override void OnInitialized()
{
toastService.Subscribe(OnUpdate);
}
public void Dispose()
{
toastService.Unsubscribe(OnUpdate);
}
void OnUpdate()
{
StateHasChanged();
}
}