2b4cad4234
- Inserito filtro in offerte in base allo stato
94 lines
2.4 KiB
C#
94 lines
2.4 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Routing;
|
|
|
|
namespace Lux.UI.Components.Layout
|
|
{
|
|
public partial class NavMenu
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public EventCallback<bool> EC_compressUpdated { get; set; }
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Methods
|
|
|
|
public void Dispose()
|
|
{
|
|
NavigationManager.LocationChanged -= OnLocationChanged;
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Properties
|
|
|
|
protected string hideText { get => showText ? "" : "invisible"; }
|
|
protected string subArtCss { get => showText ? "ps-5" : ""; }
|
|
|
|
protected string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
|
|
|
|
protected string? TextCss => onlyIcon ? "d-none" : "";
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
currentUrl = NavigationManager.ToBaseRelativePath(NavigationManager.Uri);
|
|
NavigationManager.LocationChanged += OnLocationChanged;
|
|
}
|
|
|
|
protected void ToggleCompress()
|
|
{
|
|
showText = !showText;
|
|
EC_compressUpdated.InvokeAsync(showText);
|
|
}
|
|
protected void ToggleNavMenu()
|
|
{
|
|
collapseNavMenu = !collapseNavMenu;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private bool collapseNavMenu = true;
|
|
private bool isArticoliOpen = false;
|
|
private bool isCicloProdOpen = false;
|
|
private bool isContattiOpen = false;
|
|
private string? currentUrl;
|
|
private bool onlyIcon = false;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private bool showText { get; set; } = true;
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private void OnLocationChanged(object? sender, LocationChangedEventArgs e)
|
|
{
|
|
currentUrl = NavigationManager.ToBaseRelativePath(e.Location);
|
|
StateHasChanged();
|
|
}
|
|
private void ToggleArticoli()
|
|
{
|
|
isArticoliOpen = !isArticoliOpen;
|
|
}
|
|
private void ToggleCicloProd()
|
|
{
|
|
isCicloProdOpen = !isCicloProdOpen;
|
|
}
|
|
private void ToggleContatti()
|
|
{
|
|
isContattiOpen = !isContattiOpen;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |