Class: DocsUI::Landing

Inherits:
Phlex::HTML
  • Object
show all
Includes:
Phlex::Rails::Helpers::ImageURL, Phlex::Rails::Helpers::Request
Defined in:
app/components/docs_ui/landing.rb

Overview

The marketing landing page — a hero (an optional brand logo + eyebrow + title + lead + optional install snippet + CTA buttons), a feature-card grid, and a registry-grouped documentation index — rendered inside DocsUI::Shell. Every consuming site was hand-rolling this; drive it from config instead:

# config/initializers/docs_kit.rb
DocsKit.configure do |c|
c.landing.     = { svg: "M4 2h9l5 5…Z", viewbox: "0 0 22 24", label: "Acme" }
c.landing.eyebrow  = "Developer Docs"
c.landing.title    = "Jobs & events on **Postgres**"   # ** ** → primary color
c.landing.lead     = "PostgreSQL-native jobs + event bus for Rails."
c.landing.install  = { code: 'gem "pgbus"', filename: "Gemfile", lexer: :ruby }
c.landing.ctas     = [{ label: "Get started", href: "/docs/overview", style: :primary }]
c.landing.features = [{ icon: "database", title: "One database", body: "No Redis." }]
end

# a controller that includes DocsKit::Controller
def show = render_page(DocsUI::Landing.new)

Everything is optional: with an empty c.landing it still renders a minimal hero (the brand name + the doc index), never a broken page. The doc index is built from DocsKit.configuration.nav_groups — the same registry the sidebar uses — so it never drifts from the authored pages.

It IS a full document (composes Shell), so a controller renders it with layout: false, exactly like DocsUI::Page (DocsKit::Controller#render_page does this). The .md/.text twin of the landing works too — MarkdownExport walks the same #docs-content region Shell stamps.

Instance Method Summary collapse

Instance Method Details

#view_templateObject



38
39
40
41
42
43
44
45
46
# File 'app/components/docs_ui/landing.rb', line 38

def view_template
  render DocsUI::Shell.new(title: landing.eyebrow || config.brand) do
    div(class: "mx-auto max-w-5xl") do
      hero
      feature_grid
      doc_index
    end
  end
end