Class: DocsUI::Sidebar

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

Overview

The drawer sidebar: a brand header (with an optional version badge) over the nav, driven entirely by DocsKit.configuration.nav_groups. Renders inside the daisyUI drawer-side (DocsUI::Shell owns responsive visibility), so this is just the panel content.

nav_groups is an ordered Hash:

{ "Heading" => { "Subgroup" => [DocsKit::NavItem, ...] } }

Constant Summary collapse

MARKER_RESET =

Suppress the browser's native

disclosure triangle on nav summaries. daisyUI draws its OWN rotating chevron (li>details>summary::after), so the native marker would render a SECOND, non-rotating caret stacked next to it. daisyUI only hides the old ::-webkit-details-marker; modern browsers (and Safari) also need list-none + the standard ::marker reset. Literal classes — Tailwind tree-shakes interpolated ones.

"list-none [&::-webkit-details-marker]:hidden [&::marker]:content-none"

Instance Method Summary collapse

Instance Method Details

#view_templateObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/components/docs_ui/sidebar.rb', line 23

def view_template
  # The docs-nav Stimulus controller lives on <body> (DocsUI::Shell) so it spans
  # this sidebar AND the content column. Here it drives collapse persistence
  # and, in :sidebar mode, hosts the injected page TOC. With JS off the server
  # renders every <details open>, so the sidebar is simply fully expanded.
  div(class: "bg-base-200 flex min-h-full w-72 flex-col") do
    header_section
    div(class: "flex-1 overflow-y-auto px-2 pb-6") do
      Menu(class: "w-full gap-1") do
        nav_groups.each { |heading, grouped| nav_group(heading, grouped) }
      end
    end
  end
end