using Microsoft.AspNetCore.Components; namespace Elternbeirat.Web.Shared; /// /// Renders a decorative line icon from as inline SVG. /// /// /// Inline SVG, not an <img> or icon font: no extra request, nothing /// from a third-party host, and the icon follows the text colour (including dark /// mode) through currentColor. The icon is hidden from assistive technology, /// so it must never be the only carrier of meaning. /// /// /// /// <Icon Name="map-pin" /> Aula /// <Icon Name="calendar" Size="16" /> /// /// /// public partial class Icon { /// /// The inner SVG markup of the current icon, or when the /// name is unknown and nothing should render. /// private MarkupString? _markup; /// /// The icon name, e.g. calendar; see for the set. /// [Parameter] [EditorRequired] public string Name { get; set; } = ""; /// /// Width and height in CSS pixels. Defaults to 20, which sits well next /// to body text. /// [Parameter] public int Size { get; set; } = 20; /// protected override void OnParametersSet() => _markup = IconSet.Find(Name) is { } markup ? new MarkupString(markup) : null; }