private void BuildNavbarRightContent(NavBarTagHelperContext navbarContext, StringBuilder sb) { // this empty ul fixes sb.Append(@"<ul class=""navbar-nav ml-auto"">"); sb.Append(@"<li class=""nav-item""> </li>"); sb.Append(@"</ul>"); sb.Append(navbarContext.NavbarRightHtml); sb.Append(BuildControlSidebarTogglerHtml()); }
private string BuildHtmlContent(NavBarTagHelperContext navbarContext) { var sb = new StringBuilder(); BuildNavbarLeftContent(navbarContext, sb); BuildNavbarRightContent(navbarContext, sb); return(sb.ToString()); }
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { var navbarContext = new NavBarTagHelperContext(); context.Items.Add(typeof(NavBarTagHelperContext), navbarContext); await output.GetChildContentAsync(); output.TagName = "nav"; output.Attributes.Add("class", "main-header navbar navbar-expand navbar-white navbar-light"); output.Content.SetHtmlContent(BuildHtmlContent(navbarContext)); }
private void BuildNavbarLeftContent(NavBarTagHelperContext navbarContext, StringBuilder sb) { sb.Append(BuildMainSidebarTogglerHtml()); sb.Append(navbarContext.NavbarLeftHtml); }