public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { if (!isVisible) { output.SuppressOutput(); } else { var embeddedContent = await output.GetChildContentAsync(); output.TagName = "div"; output.AddCssClass("icon-card-body"); if (!IsCard) { output.AddCssClass(Class); } #region << Init wrappers >> var cardWrapperEl = new TagBuilder("div"); cardWrapperEl.AddCssClass("card icon-card"); if (IsClickable) { cardWrapperEl.AddCssClass("clickable"); } cardWrapperEl.AddCssClass(Class); if (HasShadow) { cardWrapperEl.AddCssClass("shadow-sm"); } if (!String.IsNullOrWhiteSpace(Id)) { cardWrapperEl.Attributes.Add("id", Id); } var cardBodyWrapperEl = new TagBuilder("div"); cardBodyWrapperEl.AddCssClass("card-body p-2"); if (IsCard) { output.PreElement.AppendHtml(cardWrapperEl.RenderStartTag()); output.PreElement.AppendHtml(cardBodyWrapperEl.RenderStartTag()); output.PostElement.AppendHtml(cardBodyWrapperEl.RenderEndTag()); output.PostElement.AppendHtml(embeddedContent); output.PostElement.AppendHtml(cardWrapperEl.RenderEndTag()); } #endregion var IconEl = new TagBuilder("i"); IconEl.AddCssClass("icon"); IconEl.AddCssClass(IconClass); if (IconColor != WvColor.Default) { IconEl.AddCssClass("go-" + IconColor.GetLabel()); } if (!IsIconRight) { output.Content.AppendHtml(IconEl); } var metaEl = new TagBuilder("div"); metaEl.AddCssClass("meta"); var metaTitleEl = new TagBuilder("div"); metaTitleEl.AddCssClass("title"); metaTitleEl.InnerHtml.AppendHtml(Title); metaEl.InnerHtml.AppendHtml(metaTitleEl); var metaDescriptionEl = new TagBuilder("div"); metaDescriptionEl.AddCssClass("description"); metaDescriptionEl.InnerHtml.AppendHtml(Description); metaEl.InnerHtml.AppendHtml(metaDescriptionEl); output.Content.AppendHtml(metaEl); if (IsIconRight) { output.Content.AppendHtml(IconEl); } if (!String.IsNullOrWhiteSpace(BodyLink)) { var linkEl = new TagBuilder("a"); linkEl.AddCssClass("link"); linkEl.Attributes.Add("href", BodyLink); linkEl.InnerHtml.AppendHtml("<em></em>"); output.Content.AppendHtml(linkEl); } } }
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { var embeddedContent = await output.GetChildContentAsync(); output.TagName = "div"; output.AddCssClass("icon-card-body"); if (!IsCard) { output.AddCssClass(Class); } #region << Init wrappers >> var cardWrapperEl = new TagBuilder("div"); cardWrapperEl.AddCssClass("card icon-card"); if (IsClickable) { cardWrapperEl.AddCssClass("clickable"); } cardWrapperEl.AddCssClass(Class); if (HasShadow) { cardWrapperEl.AddCssClass("shadow-sm"); } var cardBodyWrapperEl = new TagBuilder("div"); cardBodyWrapperEl.AddCssClass("card-body p-2"); if (IsCard) { output.PreElement.AppendHtml(cardWrapperEl.RenderStartTag()); output.PreElement.AppendHtml(cardBodyWrapperEl.RenderStartTag()); output.PostElement.AppendHtml(cardBodyWrapperEl.RenderEndTag()); output.PostElement.AppendHtml(embeddedContent); output.PostElement.AppendHtml(cardWrapperEl.RenderEndTag()); } #endregion var IconEl = new TagBuilder("i"); IconEl.AddCssClass("icon"); IconEl.AddCssClass(IconClass); if (IconColor != ErpColor.Default) { IconEl.AddCssClass("go-" + IconColor.GetLabel()); } output.Content.AppendHtml(IconEl); var metaEl = new TagBuilder("div"); metaEl.AddCssClass("meta"); var metaTitleEl = new TagBuilder("div"); metaTitleEl.AddCssClass("title"); metaTitleEl.InnerHtml.AppendHtml(Title); metaEl.InnerHtml.AppendHtml(metaTitleEl); var metaDescriptionEl = new TagBuilder("div"); metaDescriptionEl.AddCssClass("description"); metaDescriptionEl.InnerHtml.AppendHtml(Description); metaEl.InnerHtml.AppendHtml(metaDescriptionEl); output.Content.AppendHtml(metaEl); }