using System.Collections.Frozen; namespace Elternbeirat.Web.Shared; /// /// The fixed set of line icons the site can show, keyed by name. /// /// /// The icons are inlined as SVG markup instead of being loaded from an icon font or /// a CDN: the site loads nothing from third-party hosts (see docs/recht.md), /// and inline SVG needs no extra request and inherits the text colour. /// /// Source: Lucide (lucide.dev), ISC license; the icons derived from /// Feather (calendar, clock, download, /// external-link, help-circle, info, arrow-right, /// arrow-left) /// are MIT, Copyright (c) 2013-present Cole Bemis. Both licenses only ask that /// the notice travels with the copy, which this comment does. Only the inner /// elements are stored; supplies the shared /// <svg> wrapper (24x24 view box, 2px round stroke). /// /// /// Lucide renamed help-circle to circle-question-mark; the old /// name is kept here because it is the one the design work refers to. /// /// /// public static class IconSet { /// /// Inner SVG markup per icon name. Ordinal keys: names are code identifiers, /// not visitor text, so Calendar is deliberately not calendar. /// private static readonly FrozenDictionary Icons = new Dictionary { ["calendar"] = """""", ["calendar-plus"] = """""", ["clock"] = """""", ["map-pin"] = """""", ["file-text"] = """""", ["download"] = """""", ["mail"] = """""", ["users"] = """""", ["heart-handshake"] = """""", ["help-circle"] = """""", ["newspaper"] = """""", ["arrow-left"] = """""", ["arrow-right"] = """""", ["external-link"] = """""", ["info"] = """""", }.ToFrozenDictionary(StringComparer.Ordinal); /// /// Looks up the inner SVG markup of an icon. /// /// /// The icon name, e.g. calendar or map-pin. Case-sensitive. /// /// /// The SVG child elements (paths, circles, rects) to place inside an /// <svg>, or if is /// or not part of the set. /// /// /// An unknown name yields rather than an exception, so a /// typo costs a missing decoration, never a broken page. /// public static string? Find(string? name) => name is null ? null : Icons.GetValueOrDefault(name); }