Files
Shogi/Shogi.UI/Shared/Modal/Modals.razor

40 lines
932 B
Plaintext

@inject ModalService modalService
@inject AccountManager Account
@inject NavigationManager NavManager
@inject ILocalStorage localStorage
@if (shouldShow)
{
<div class="my-modal-background">
<div class="my-modal">
@if (modalService.LoginModalIsVisible)
{
}
else if (modalService.GuestAccountDescriptionIsVisible)
{
}
</div>
</div>
}
@code {
bool shouldShow = false;
protected override void OnInitialized()
{
modalService.ModalVisibilityChangedEvent += OnModalChange;
}
void OnModalChange(object? sender, ModalVisibilityChangedEventArgs args)
{
Console.WriteLine("Modal Change");
if (args != null)
{
shouldShow = args.LoginModalIsVisible || args.GuestAccountDescriptionIsVisible;
StateHasChanged();
}
}
}