Ui/Punchboard/PbTagPill.razor

The component renders a stylized tag element. It displays an icon derived from the PbTag and optionally renders a text label generated from the tag or a custom label parameter.

@namespace CitySim.Punchboard
@using Sandbox.UI
@inherits Panel

<root class="pb-tag @Tag.Css() @(Compact ? "compact" : "")">
	<span class="pb-tag-icon">@Pb.Icon( Tag )</span>
	@if ( !IconOnly ) { <span class="pb-tag-name">@(Label ?? GameText.EnumLabel(Tag))</span> }
</root>

@code
{
	[Parameter] public PbTag Tag { get; set; }
	[Parameter] public bool Compact { get; set; }
	[Parameter] public bool IconOnly { get; set; }

	/// <summary>Overrides the visible text (for localisation).</summary>
	[Parameter] public string Label { get; set; }

	protected override int BuildHash() => HashCode.Combine(GameText.LanguageCode, HashCode.Combine( Tag, Label, Compact, IconOnly ));
}