summaryrefslogtreecommitdiff
path: root/Pages/Component/Dialog.razor
diff options
context:
space:
mode:
Diffstat (limited to 'Pages/Component/Dialog.razor')
-rw-r--r--Pages/Component/Dialog.razor14
1 files changed, 11 insertions, 3 deletions
diff --git a/Pages/Component/Dialog.razor b/Pages/Component/Dialog.razor
index 673ec2f..8e8ddca 100644
--- a/Pages/Component/Dialog.razor
+++ b/Pages/Component/Dialog.razor
@@ -4,7 +4,7 @@
<div
class="dialog"
onmousedown="dialogMouseDown(event)"
- style="opacity:0;visibility:hidden;@(heightStyle)"
+ style="opacity:0;visibility:hidden;@(sizeStyle)"
@ref=dialogDiv>
@if(Title is not null) {
<div class="titlebar" onmousedown="dialogTitleMouseDown(event)">
@@ -25,6 +25,8 @@
public RenderFragment ChildContent { get; set; }
[Parameter]
+ public int WidthPixels { set => width = $"{value}px"; }
+ [Parameter]
public int HeightPixels { set => height = $"{value}px"; }
[Parameter]
public int HeightPercent { set => height = $"{value}%"; }
@@ -41,6 +43,7 @@
private bool visible = false;
+ private string? width;
private string? height;
private ElementReference dialogDiv;
@@ -53,7 +56,7 @@
await jsRuntime.InvokeVoidAsync("dialogAddObjectReference", new object[] {
dialogDiv,
DotNetObjectReference.Create(this)
- });
+ });
}
}
@@ -65,6 +68,11 @@
}
}
+ private string sizeStyle => widthStyle + heightStyle;
+
+ private string widthStyle =>
+ $"{(width is null ? "" : $"width:{width};")}";
+
private string heightStyle =>
- $"{(height is null ? "" : $"max-height:{height};")}";
+ $"{(height is null ? "" : $"max-height:{height};")}";
}