Escali License control 1
TableHideable.razor
Gå til dokumentasjonen til denne filen.
1<tr class="@StyleClass">
2 <td class="table-col-first">
3 <img style="cursor: pointer;
4 transform: rotate(@ButtonRotation()deg);
5 transition: transform 0.1s"
6 src="Icons/arrow-icon.svg" alt="" @onclick="ToggleView" />
7 </td>
8 @AlwaysShowContent
9</tr>
10
11@if (ShowContent)
12{
13 @HideableContent
14}
15
16@code {
17
18 [Parameter]
19 public RenderFragment? AlwaysShowContent { get; set; }
20
21 [Parameter]
22 public RenderFragment? HideableContent { get; set; }
23
24 [Parameter]
25 public string? StyleClass { get; set; }
26
27 private bool ShowContent { get; set; } = false;
28
29 private string ButtonRotation() => ShowContent ? "180" : "90";
30
31 private void ToggleView()
32 {
33 ShowContent = !ShowContent;
34 }
35
36
37
38}