blob: ded2d2d9b0905fbc56329d29276035ef979005e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
<div style="@(heightStyle + visiblilityStyle)">
@if(Title is not null) {
<p>@Title</p>
<hr/>
}
@ChildContent
</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;
StateHasChanged();
}
}
public void Show() => Visible = true;
public void Hide() => Visible = false;
private bool visible = false;
private string? height;
private string heightStyle =>
$"{(height is null ? "" : $"max-height:{height};")}";
private string visiblilityStyle =>
Visible ? "opacity:1;visibility:visible;" : "opacity:0;visibility:hidden;";
}
|