Files
lux/Lux.UI/Components/Layout/GroupElem.razor.cs
T

58 lines
1.6 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations.Operations;
namespace Lux.UI.Components.Layout
{
public partial class GroupElem
{
[Parameter]
public List<string> NameList { get; set; } = new List<string>();
[Parameter]
public List<string> PageList { get; set; } = new List<string>();
[Parameter]
public List<string> IconList { get; set; } = new List<string>();
[Parameter]
public bool ShowText { get; set; } = true;
protected string hideText { get => ShowText ? "" : "invisible"; }
protected string subArtCss { get => ShowText ? "ps-5 pe-3" : "ps-5 pe-2"; }
private bool isMenuOpen = false;
public List<string> subElement { get; set; } = new List<string>();
public List<string> subIcon { get; set; } = new List<string>();
private void Toggle()
{
isMenuOpen = !isMenuOpen;
UpdateData();
}
private void UpdateData()
{
subElement = new List<string>();
subIcon = new List<string>();
for(int i = 1; i <NameList.Count; i++)
{
subElement.Add(NameList[i]);
subIcon.Add(IconList[i]);
}
}
private string GetSubIcon(string elem)
{
int indice = subElement.IndexOf(elem);
return subIcon.ElementAt(indice);
}
private string GetPage(string elem)
{
int indice = subElement.IndexOf(elem);
return PageList.ElementAt(indice);
}
}
}