Skip to content

fix: consumer-configurable brand logo across sidebar / header / footer - #15

Merged
Shewart merged 3 commits into
mainfrom
fix/consumer-brand-logo
Jul 24, 2026
Merged

fix: consumer-configurable brand logo across sidebar / header / footer#15
Shewart merged 3 commits into
mainfrom
fix/consumer-brand-logo

Conversation

@Shewart

@Shewart Shewart commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Second dogfood-driven fix (see docs/SHELLUI_DOGFOOD_FIXES.md). The chrome components were rendering a hardcoded rounded-square dot placeholder next to Options.SiteName, with no config path for a real brand mark — consumers had to resort to CSS background-image overrides with !important to defeat Blazor scoped-CSS attribute-selector specificity.

The fix

New ShellDocsOptions surface

public string? LogoLight { get; set; }
public string? LogoDark  { get; set; }
public string? LogoAlt   { get; set; }        // defaults to SiteName in render
public double  LogoHeight { get; set; } = 1.375;   // rem

public ShellDocsOptions SetLogo(string url, string? alt = null);
public ShellDocsOptions SetLogo(string lightUrl, string darkUrl, string? alt = null);

Consumers:

builder.Services.AddShellDocs(o =>
{
    o.SetLogo("/img/logo-light.svg", "/img/logo-dark.svg", alt: "ShellUI");
});

Shared <BrandLogo /> component

src/ShellDocs.Components/Chrome/BrandLogo.razor — renders both light + dark <img> tags as siblings when logos are configured; :root.dark .brand-logo-light { display: none } / :root.dark .brand-logo-dark { display: inline-block } handles per-theme visibility. Theme toggle is instant CSS — no re-render, no <picture> prefers-color-scheme mismatch with the class-based theme system.

Falls back to the existing <span class="brand-logo-dot"> placeholder when no logos are set — backward-compatible for the preview app and any consumer that hasn't opted in.

Chrome components consolidated

All three components (DocsSidebarHeader, DocsHeader, DocsFooter) previously carried their own .docs-*-logo-dot markup + CSS block. Now they render <BrandLogo /> and the three dot-block CSS rules are deleted. Net negative LOC.

Test plan

  • dotnet build shelldocs.slnx — clean, 0 warnings, 0 errors
  • dotnet test shelldocs.slnx125 / 125 passing (+4 in BrandLogoOptionsTests)
  • Preview smoke, no SetLogo call:
    • <span class="brand-logo-dot"> renders in sidebar, header, footer — backward-compatible with existing shelldocs-preview UX
  • Preview smoke, SetLogo("/img/logo-light.svg", "/img/logo-dark.svg", "ShellDocs") (temporarily wired, verified, reverted):
    • Both <img class="brand-logo brand-logo-light"> and <img class="brand-logo brand-logo-dark"> land with correct src, alt="ShellDocs", style="height: 1.375rem"
    • :root.dark .brand-logo-light { display: none } hides the light img in dark mode
    • Preview app's Program.cs reverted to its zero-config state after verification — no ambient logo added to shelldocs-preview

Files touched

  • src/ShellDocs.Components/ShellDocsOptions.cs — logo props + SetLogo overloads
  • src/ShellDocs.Components/Chrome/BrandLogo.razor (new) + .razor.css (new)
  • src/ShellDocs.Components/Chrome/DocsSidebarHeader.razor + .razor.css
  • src/ShellDocs.Components/Chrome/DocsHeader.razor + .razor.css
  • src/ShellDocs.Components/Chrome/DocsFooter.razor + .razor.css
  • tests/ShellDocs.Tests/BrandLogoOptionsTests.cs (new)
  • docs/SHELLUI_DOGFOOD_FIXES.md — moved to Fixed

@Shewart
Shewart merged commit ba33c44 into main Jul 24, 2026
1 check passed
@Shewart
Shewart deleted the fix/consumer-brand-logo branch July 25, 2026 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant