diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-08-28 23:36:15 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2025-08-20 00:48:43 +1000 |
| commit | 56be93c99aeb12d6f3bf65ead283364b75d9cbe1 (patch) | |
| tree | 1d72b5f61378245dffab67948bd3262385f0cbdc /Pages/Component/Dialog.razor | |
| parent | 6af0c3ec95eac6bf2979869a970ba65cfaeae3f4 (diff) | |
Fixed dialog bug causing dialogs to be shown briefly during page load
Diffstat (limited to 'Pages/Component/Dialog.razor')
| -rw-r--r-- | Pages/Component/Dialog.razor | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Pages/Component/Dialog.razor b/Pages/Component/Dialog.razor index 1e2929a..ded2d2d 100644 --- a/Pages/Component/Dialog.razor +++ b/Pages/Component/Dialog.razor @@ -1,4 +1,4 @@ -<div style="@style" class="@(visible ? "visible" : "")"> +<div style="@(heightStyle + visiblilityStyle)"> @if(Title is not null) { <p>@Title</p> <hr/> @@ -13,6 +13,11 @@ [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 { @@ -21,11 +26,6 @@ } } - [Parameter] - public int HeightPixels { set => height = $"{value}px"; } - [Parameter] - public int HeightPercent { set => height = $"{value}%"; } - public void Show() => Visible = true; public void Hide() => Visible = false; @@ -33,6 +33,9 @@ private string? height; - private string style => + private string heightStyle => $"{(height is null ? "" : $"max-height:{height};")}"; + + private string visiblilityStyle => + Visible ? "opacity:1;visibility:visible;" : "opacity:0;visibility:hidden;"; } |
