diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-08-28 23:36:15 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2023-08-28 23:36:15 +1000 |
| commit | f0682d7760b99a553fe11f241551adc87d4c0d13 (patch) | |
| tree | b02393f9365b6ea9132946dd1d8217799bc34021 /Pages/Component/Dialog.razor | |
| parent | bbe7c69c234f8c320ebfe3c5bcd280abf7be0a9a (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;"; } |
