public void Should_return_the_ArrowCircleDown_icon_in_the_solid_style() { // Given var icon = IconList.Solid(IconSymbol.ArrowCircleDown); // When / Then icon.Path.ShouldBe("<path fill-rule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm1-11a1 1 0 10-2 0v3.586L7.707 9.293a1 1 0 00-1.414 1.414l3 3a1 1 0 001.414 0l3-3a1 1 0 00-1.414-1.414L11 10.586V7z\" clip-rule=\"evenodd\"/>"); icon.ViewBox.ShouldBe("0 0 20 20"); icon.StrokeWidth.ShouldBeNull(); }
public override void Process(TagHelperContext context, TagHelperOutput output) { if (context is null) { throw new ArgumentNullException(nameof(context)); } if (output is null) { throw new ArgumentNullException(nameof(output)); } var isSolid = context.TagName.Equals("heroicon-solid", StringComparison.OrdinalIgnoreCase); var icon = isSolid ? IconList.Solid(Icon) : IconList.Outline(Icon); output.TagMode = TagMode.StartTagAndEndTag; output.TagName = "svg"; if (isSolid) { output.Attributes.SetAttribute("fill", "currentColor"); } else { output.Attributes.SetAttribute("fill", "none"); output.Attributes.SetAttribute("stroke", "currentColor"); output.Attributes.SetAttribute("stroke-width", StrokeWidth ?? icon.StrokeWidth); } output.Attributes.SetAttribute("viewbox", icon.ViewBox); output.Content.AppendHtml(icon.Path); if (_settings.IncludeComments) { output.PreElement.AppendHtml("<!-- Heroicon name: "); output.PreElement.AppendHtml(isSolid ? "solid" : "outline"); output.PreElement.AppendHtml(" "); output.PreElement.Append(icon.Name); output.PreElement.AppendHtml(" -->"); } }