using Spry; /** * NavSidebarComponent - A simple navigation sidebar for the documentation site * * Features: * - All items always visible (no collapsing) * - Current page highlighting */ public class NavSidebarComponent : Component { public string current_path { get; set; default = "/"; } public override string markup { get { return """ """; }} public override async void prepare() throws Error { // Highlight the current page link highlight_current_link(); } private void highlight_current_link() { // Get the sid for the current path and add active class string? sid = get_sid_for_path(current_path); if (sid != null) { var link = this[sid]; if (link != null) { link.add_class("active"); } } } private string? get_sid_for_path(string path) { switch (path) { case "/": return "home-link"; case "/components/overview": return "components-overview"; case "/components/template-syntax": return "components-template-syntax"; case "/components/actions": return "components-actions"; case "/components/outlets": return "components-outlets"; case "/components/continuations": return "components-continuations"; case "/page-components/overview": return "page-components-overview"; case "/page-components/templates": return "page-components-templates"; case "/static-resources/overview": return "static-resources-overview"; case "/static-resources/spry-mkssr": return "static-resources-spry-mkssr"; default: return null; } } }