141 lines
4.0 KiB
Plaintext
141 lines
4.0 KiB
Plaintext
@implements IDisposable;
|
|
@inject IMyDialogService MyDialogService
|
|
@inject IJSRuntime JsRuntime
|
|
|
|
@inject NavigationManager NavigationManager
|
|
|
|
@if (MyDialogService.IsVisible)
|
|
{
|
|
<div class="dialogOverlay" onclick="@CloseDialog">
|
|
<div class="dialogContainer dialogConfirm"
|
|
@onclick:preventDefault="true"
|
|
@onclick:stopPropagation="true">
|
|
|
|
<div class="dialogHeader">
|
|
<div class="dialogTitle">@MyDialogService.GetDialogContents().Title</div>
|
|
<button class="dialogCloseBtn" @onclick="CloseDialog">×</button>
|
|
</div>
|
|
|
|
<div class="dialogBody">
|
|
@MyDialogService.GetDialogContents().Message
|
|
</div>
|
|
|
|
<div class="dialogFooter">
|
|
<ButtonComponent MyButtonType="MyButtonType.Secondary"
|
|
OnClick="MyDialogService.GetDialogContents().OnCancel">
|
|
Cancel
|
|
</ButtonComponent>
|
|
<ButtonComponent MyButtonType="MyButtonType.Primary"
|
|
OnClick="MyDialogService.GetDialogContents().OnConfirm">
|
|
@MyDialogService.GetDialogContents().ConfirmButtonLabel
|
|
</ButtonComponent>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<style>
|
|
.dialogOverlay {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100vw;
|
|
height: 100vh;
|
|
background-color: rgba(0, 0, 0, 0.6);
|
|
display: flex;
|
|
align-items: flex-start;
|
|
justify-content: center;
|
|
z-index: 1000;
|
|
padding-top: 64px;
|
|
}
|
|
|
|
.dialogContainer {
|
|
background-color: var(--paper);
|
|
border-radius: var(--dialog-radius);
|
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
|
|
display: flex;
|
|
flex-direction: column;
|
|
max-height: calc(100vh - 128px);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.dialogConfirm {
|
|
width: 480px;
|
|
}
|
|
|
|
.dialogHeader {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 16px 20px;
|
|
border-bottom: 1px solid var(--paper-border);
|
|
background-color: var(--accent);
|
|
border-radius: var(--dialog-radius) var(--dialog-radius) 0 0;
|
|
min-height: 56px;
|
|
}
|
|
|
|
.dialogTitle {
|
|
font-size: 1.25rem;
|
|
font-weight: 700;
|
|
color: white;
|
|
}
|
|
|
|
.dialogCloseBtn {
|
|
background: none;
|
|
border: none;
|
|
color: rgba(255, 255, 255, 0.7);
|
|
font-size: 1.5rem;
|
|
cursor: pointer;
|
|
padding: 0;
|
|
line-height: 1;
|
|
width: 32px;
|
|
height: 32px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
border-radius: 6px;
|
|
transition: background 0.15s, color 0.15s;
|
|
}
|
|
|
|
.dialogCloseBtn:hover {
|
|
background: rgba(255, 255, 255, 0.15);
|
|
color: white;
|
|
}
|
|
|
|
.dialogBody {
|
|
padding: 20px;
|
|
overflow-y: auto;
|
|
flex: 1;
|
|
color: var(--text-primary, #ddd);
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.dialogFooter {
|
|
display: flex;
|
|
gap: 12px;
|
|
justify-content: flex-end;
|
|
padding: 16px 20px;
|
|
border-top: 1px solid var(--paper-border);
|
|
background-color: var(--background);
|
|
border-radius: 0 0 var(--dialog-radius) var(--dialog-radius);
|
|
}
|
|
</style>
|
|
}
|
|
|
|
@code {
|
|
protected override void OnInitialized()
|
|
{
|
|
base.OnInitialized();
|
|
MyDialogService.Subscribe(() => InvokeAsync(StateHasChanged));
|
|
}
|
|
|
|
void IDisposable.Dispose()
|
|
{
|
|
MyDialogService.Unsubscribe(() => InvokeAsync(StateHasChanged));
|
|
}
|
|
|
|
public void CloseDialog()
|
|
{
|
|
MyDialogService.Hide();
|
|
}
|
|
}
|