Skip to content

fix(sidebar,preview,scaffold,options): pin footer everywhere, visible razor:preview error, namespacePrefix overload, LayoutVariant hintFix/sidebar footer and dogfood batch - #23

Merged
Shewart merged 5 commits into
mainfrom
fix/sidebar-footer-and-dogfood-batch
Aug 22, 2026
Merged

fix(sidebar,preview,scaffold,options): pin footer everywhere, visible razor:preview error, namespacePrefix overload, LayoutVariant hintFix/sidebar footer and dogfood batch#23
Shewart merged 5 commits into
mainfrom
fix/sidebar-footer-and-dogfood-batch

Conversation

@Shewart

@Shewart Shewart commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Second dogfood-driven batch. 0.1.3-alpha pinned the sidebar footer under the desktop Sidebar variant only — footer still floated mid-sidebar on TopNav, mobile drawer, and short-tree Sidebar-variant cases. This batch fixes that plus four items surfaced by SHELLDOCS_FIXES.md while a consumer (shellicons-docs) was set up against 0.1.3-alpha.

Bumps Directory.Build.props to 0.1.4-alpha and adds a matching CHANGELOG entry. Post-merge tag v0.1.4-alpha fires the release workflow.

What's in

Fixed

  • Sidebar footer now pins to the bottom in every layout context. Moved flex: 1; min-height: 0 onto .docs-sidebar itself (was scoped inside @media (min-width: 1024px) + .docs-shell-sidebar in 0.1.3-alpha) and lifted display: flex; flex-direction: column onto the base .docs-sidebar-slot rule (was only in the desktop Sidebar-variant block). Footer sits hard against the bottom regardless of variant / viewport / item count.
  • razor:preview fences with an unknown outer tag now render a visible error inline instead of falling through to a plain code block silently. SlotExtractor.TryBuildPreviewSlot previously returned null on an unregistered tag; the fence rendered as regular fenced code with only a build-log warning, sending authors hunting for a nonexistent component bug. It now emits a PreviewSlot with ComponentType = null + an Error message, and PreviewFrame renders a red-tinted error panel in the render region naming the unknown tag and pointing at o.RegisterComponent<T>() / o.RegisterComponentsFromAssembly<TMarker>().

Added

  • RegisterComponentsFromAssembly<TMarker>(string namespacePrefix) overload on ShellDocsOptions. Common "register everything under my Components namespace" case reads as o.RegisterComponentsFromAssembly<Marker>("ShellIcons.Icons") instead of the Func<Type, bool> form. Lambda overload stays.
  • shelldocs init scaffolded Program.cs now surfaces the LayoutVariant knob — commented // o.LayoutVariant = DocsLayoutVariant.Sidebar; line right in the AddShellDocs(...) block, plus a RegisterComponentsFromAssembly hint. First-time consumers don't have to grep ShellDocs.Components/Layouts/DocsLayout.razor to discover the sidebar-variant option exists.

Files

Modified — 8 source files + 3 metadata:

  • src/ShellDocs.Components/Chrome/DocsSidebar.razor.css
  • src/ShellDocs.Components/Layouts/DocsLayout.razor.css
  • src/ShellDocs.Components/Content/PreviewFrame.razor + .razor.css
  • src/ShellDocs.Components/ShellDocsOptions.cs
  • src/ShellDocs.Markdown/RenderedDocument.cs
  • src/ShellDocs.Markdown/SlotExtractor.cs
  • src/ShellDocs.Templates/ScaffoldTemplates.cs
  • CHANGELOG.md — new [0.1.4-alpha] section
  • Directory.Build.props0.1.3-alpha0.1.4-alpha

…ation; improve error handling in PreviewFrame and add error styling
… component registration for improved clarity
…oter fixes, error handling improvements in PreviewSlot, and new component registration options
Copilot AI lite review requested due to automatic review settings August 22, 2026 19:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is a dogfood-driven batch that improves ShellDocs’ layout behavior (sidebar footer pinning across variants) and improves authoring feedback by making razor:preview failures visible in the rendered preview frame, while also adding a convenience ShellDocsOptions overload and updating scaffolding/version metadata.

Changes:

  • Make sidebar slot/nav flex behavior consistent so the sidebar footer pins to the bottom across TopNav, Sidebar variant, mobile drawer, and short-tree cases.
  • Change razor:preview handling so unknown components produce an inline error panel (via nullable PreviewSlot.ComponentType + PreviewSlot.Error) instead of silently falling back to a plain code block.
  • Add RegisterComponentsFromAssembly<TMarker>(string namespacePrefix) (and Assembly equivalent), update shelldocs init scaffold hints, and bump version + changelog.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/ShellDocs.Templates/ScaffoldTemplates.cs Updates scaffolded Program.cs comments to surface layout variant and component registration hints.
src/ShellDocs.Markdown/SlotExtractor.cs Emits an error PreviewSlot (nullable type + message) when preview tag is unknown.
src/ShellDocs.Markdown/RenderedDocument.cs Extends PreviewSlot to allow ComponentType to be null and adds an Error field.
src/ShellDocs.Components/ShellDocsOptions.cs Adds namespace-prefix overloads for assembly component registration.
src/ShellDocs.Components/Layouts/DocsLayout.razor.css Makes .docs-sidebar-slot a flex column in all contexts; refactors sidebar-variant overrides accordingly.
src/ShellDocs.Components/Content/PreviewFrame.razor.css Adds styling for the inline preview error panel.
src/ShellDocs.Components/Content/PreviewFrame.razor Renders either the component or an inline error panel when ComponentType is null.
src/ShellDocs.Components/Chrome/DocsSidebar.razor.css Moves flex sizing responsibilities to .docs-sidebar to keep footer pinned across contexts.
Directory.Build.props Bumps package version to 0.1.4-alpha.
CHANGELOG.md Adds 0.1.4-alpha entry describing the fixes/additions.
Suppressed comments (1)

src/ShellDocs.Components/ShellDocsOptions.cs:80

  • namespacePrefix validation should reject whitespace-only values too (consistent with RegisterComponent<T>(string tagName) using IsNullOrWhiteSpace).
    public ShellDocsOptions RegisterComponentsFromAssembly<TMarker>(string namespacePrefix)
    {
        if (string.IsNullOrEmpty(namespacePrefix))
            throw new ArgumentException("namespacePrefix must be non-empty.", nameof(namespacePrefix));
        return RegisterComponentsFromAssembly(typeof(TMarker).Assembly,

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

fence to render as a plain code block — silent failure that sent
authors hunting for a nonexistent component bug (dogfood log,
SHELLDOCS_FIXES.md #4). Warning still emitted for build logs. */
var msg = $"Unknown component <{name}>. Register it via `o.RegisterComponent<{name}>()` or `o.RegisterComponentsFromAssembly<TMarker>()`.";
Comment thread CHANGELOG.md
Comment on lines +18 to +22
- **`RegisterComponentsFromAssembly<TMarker>(string namespacePrefix)` overload.** Registering only components under a specific namespace from a big assembly no longer needs a `Func<Type, bool>` — the common "register everything under my Components namespace" case reads as:
```csharp
o.RegisterComponentsFromAssembly<Marker>("ShellIcons.Icons");
```
instead of the lambda form. The `Func` overload stays for anything more complex.
Comment on lines 72 to +76
public ShellDocsOptions RegisterComponentsFromAssembly<TMarker>(Func<Type, bool>? filter = null)
=> RegisterComponentsFromAssembly(typeof(TMarker).Assembly, filter);


public ShellDocsOptions RegisterComponentsFromAssembly<TMarker>(string namespacePrefix)
@Shewart
Shewart merged commit b90d80a into main Aug 22, 2026
1 check passed
@Shewart
Shewart deleted the fix/sidebar-footer-and-dogfood-batch branch August 22, 2026 19:10
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.

2 participants