Class: PhlexKit::Sidebar

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/sidebar/sidebar.rb

Overview

Sidebar shell, ported from ruby_ui's RubyUI::Sidebar at collapsible: :none (the NonCollapsibleSidebar path): a static flex-column rail. Deliberately WITHOUT ruby_ui's collapsible/offcanvas Stimulus controller + cookie state + mobile Sheet (the admin sidebar is static) — those can be added later if a collapsible chrome is wanted. The static part set matches shadcn/ui's Sidebar: compose with SidebarWrapper (the page root) + SidebarHeader / SidebarContent / SidebarGroup (+ Label / Content / Action) / SidebarMenu (+ Item / Button / Action / Badge / Skeleton / Sub / SubItem / SubButton) / SidebarSeparator / SidebarInput / SidebarFooter, alongside a SidebarInset for the main content. Tailwind → vanilla .pk-sidebar* (sidebar.css).

Constant Summary collapse

{ default: nil, solid: "menu-solid" }.freeze

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(menu: :default, **attrs) ⇒ Sidebar

Returns a new instance of Sidebar.



17
18
19
20
# File 'app/components/phlex_kit/sidebar/sidebar.rb', line 17

def initialize(menu: :default, **attrs)
  @menu = menu.to_sym
  @attrs = attrs
end

Instance Method Details

#view_template(&block) ⇒ Object



22
23
24
# File 'app/components/phlex_kit/sidebar/sidebar.rb', line 22

def view_template(&block)
  div(**mix({ class: classes }, @attrs), &block)
end