Extend the Section component with "Visible" parameter

This commit is contained in:
beolafsen 2023-12-01 07:34:17 +01:00
parent 3e127dbd9c
commit 0e060c4564

View File

@ -1,7 +1,9 @@
@namespace Oqtane.Modules.Controls @namespace Oqtane.Modules.Controls
@inherits LocalizableComponent @inherits LocalizableComponent
<div class="d-flex mt-2"> @if (IsVisible)
{
<div class="d-flex mt-2">
<div> <div>
<a data-bs-toggle="collapse" class="app-link-unstyled" href="#@Name" aria-expanded="@_expanded" aria-controls="@Name" @onclick:preventDefault="true"> <a data-bs-toggle="collapse" class="app-link-unstyled" href="#@Name" aria-expanded="@_expanded" aria-controls="@Name" @onclick:preventDefault="true">
<h5>@_heading</h5> <h5>@_heading</h5>
@ -12,16 +14,17 @@
<i class="oi oi-chevron-bottom"></i>&nbsp; <i class="oi oi-chevron-bottom"></i>&nbsp;
</a> </a>
</div> </div>
</div> </div>
<div class="d-flex"> <div class="d-flex">
<hr class="app-rule" /> <hr class="app-rule" />
</div> </div>
<div class="collapse @_show" id="@Name"> <div class="collapse @_show" id="@Name">
@if (ChildContent != null) @if (ChildContent != null)
{ {
@ChildContent @ChildContent
} }
</div> </div>
}
@code { @code {
private string _heading = string.Empty; private string _heading = string.Empty;
@ -40,6 +43,9 @@
[Parameter] [Parameter]
public string Expanded { get; set; } // optional - will default to false if not provided public string Expanded { get; set; } // optional - will default to false if not provided
[Parameter]
public bool IsVisible { get; set; } = true;
protected override void OnParametersSet() protected override void OnParametersSet()
{ {
base.OnParametersSet(); // must be included to call method in LocalizableComponent base.OnParametersSet(); // must be included to call method in LocalizableComponent