You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
633 B
42 lines
633 B
@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(); |
|
} |
|
|
|
} |