diff options
| author | Jake Mannens <jake@asger.xyz> | 2026-05-23 22:38:34 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2026-06-11 01:16:00 +1000 |
| commit | c5af95bd7af2c0205a0f68d67e86d0dbeba7c879 (patch) | |
| tree | 2d145a92c7783517051b3268d8ebeb8f113b7721 /Pages/Component/Dialog.razor | |
| parent | c1335c865e3dd1d993e26df03fa79c353954ca75 (diff) | |
Deleted client-side Razor pages
Diffstat (limited to 'Pages/Component/Dialog.razor')
| -rw-r--r-- | Pages/Component/Dialog.razor | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/Pages/Component/Dialog.razor b/Pages/Component/Dialog.razor deleted file mode 100644 index 673ec2f..0000000 --- a/Pages/Component/Dialog.razor +++ /dev/null @@ -1,70 +0,0 @@ -@inject IJSRuntime jsRuntime -@implements IDialog - -<div - class="dialog" - onmousedown="dialogMouseDown(event)" - style="opacity:0;visibility:hidden;@(heightStyle)" - @ref=dialogDiv> - @if(Title is not null) { - <div class="titlebar" onmousedown="dialogTitleMouseDown(event)"> - <p class="title">@Title</p> - <hr/> - </div> - } - <div class="content"> - @ChildContent - </div> -</div> - -@code { - [Parameter] - public string? Title { get; set; } - - [Parameter] - public RenderFragment ChildContent { get; set; } - - [Parameter] - public int HeightPixels { set => height = $"{value}px"; } - [Parameter] - public int HeightPercent { set => height = $"{value}%"; } - - public bool Visible { - get => visible; - set { - visible = value; - jsRuntime.InvokeVoidAsync( - "setDialogVisibility", - new object?[] { dialogDiv, value }); - } - } - - private bool visible = false; - - private string? height; - - private ElementReference dialogDiv; - - public void Show() => Visible = true; - public void Hide() => Visible = false; - - protected override async void OnAfterRender(bool firstRender) { - if(firstRender) { - await jsRuntime.InvokeVoidAsync("dialogAddObjectReference", new object[] { - dialogDiv, - DotNetObjectReference.Create(this) - }); - } - } - - [JSInvokable("KeyHandler")] - public void KeyHandler(string key) { - if(key == "Escape") { - Hide(); - return; - } - } - - private string heightStyle => - $"{(height is null ? "" : $"max-height:{height};")}"; -} |
