예제 #1
0
        private string GetLinkClass(NavLink navLink)
        {
            var enabledClass = navLink.Disabled ? "disabled" : "enabled";
            var hasUrlClass  = navLink.Url.HasNoValue() ? "nourl" : "hasurl";

            var mainStyle = $"bit-nav-link-{enabledClass}-{hasUrlClass}-{VisualClassRegistrar()}";
            var selected  = navLink.Key == SelectedKey ? $"bit-nav-selected-{VisualClassRegistrar()}" : "";
            var hasIcon   = navLink.Icon.HasNoValue()
                            ? $"bit-nav-has-not-icon-{VisualClassRegistrar()}"
                            : $"bit-nav-has-icon-{VisualClassRegistrar()}";

            return($"{mainStyle} {selected} {hasIcon}");
        }
예제 #2
0
        private async Task Toggle(NavLink navLink)
        {
            if (IsEnabled is false || navLink.Disabled)
            {
                return;
            }

            if (navLink.Links?.Any() ?? false)
            {
                navLink.IsExpanded = !navLink.IsExpanded;
            }

            await OnClick.InvokeAsync(navLink);
        }