feat(landing): optional hero logo for DocsUI::Landing (c.landing.logo)

Merged
MH
4mo ago
+122-7

Why

DocsUI::Landing (shipped in #55 / v1.0.5) renders a hero of eyebrow + title + lead — but no way to show the product's own brand mark. That's the first thing a real consumer hits: adopting the component on a mounted docs app (a fintech app's /docs), the hand-rolled hero had an inline logo, and moving to the gem component would have dropped it. This adds the missing slot so the gem is a strict upgrade for that case.

What

An optional c.landing.logo, rendered above the eyebrow, in two forms:

# inline single-path SVG mark — fill: currentColor, so it adapts to the theme
c.landing.logo = { svg: "M4 2h9l5 5…Z", viewbox: "0 0 22 24", label: "Acme" }

# or an image — resolved through the site's asset pipeline (image_url)
c.landing.logo = { src: "logo.svg", alt: "Acme" }

nil (the default) omits it, so it's fully backwards-compatible — an existing DocsUI::Landing render is byte-identical.

  • Normalized into a DocsKit::LandingConfig::Logo value object (#hero_logo), mirroring Cta / Feature.
  • The inline form renders a <svg role="img" aria-label fill="currentColor"> with the path; the image form an <img>.
  • Dogfooded on the docs-kit site (c.landing.logo = an inline stacked-docs glyph), with a docs_chrome system-spec assertion (svg[aria-label='docs-kit']).
  • The generator initializer template and the component doc comment document it.

Tests

  • spec/docs_kit/landing_config_spec.rb — #hero_logo normalization (inline vs image, default viewbox, inline?).
  • docs/spec/system/docs_chrome_spec.rb — the rendered logo on the dogfood landing.

Full gem suite 759 examples, 0 failures, 94.73% line coverage; rubocop clean (131 files); dogfood system + request specs green.

Note

app/components/docs_ui/landing.rb is added to the Metrics/ClassLength exclude (alongside the OpenAPI composite renderers) — it's a multi-section renderer (logo + hero + feature grid + doc index) where each method is small; the length is section count, not complexity.