Class: EasyAdmin::NavbarComponent

Inherits:
Phlex::HTML
  • Object
show all
Defined in:
app/components/easy_admin/navbar_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(page_title: "Dashboard", breadcrumbs: nil, current_user: nil) ⇒ NavbarComponent

Returns a new instance of NavbarComponent.



3
4
5
6
7
# File 'app/components/easy_admin/navbar_component.rb', line 3

def initialize(page_title: "Dashboard", breadcrumbs: nil, current_user: nil)
  @page_title = page_title
  @breadcrumbs = breadcrumbs
  @current_user = current_user
end

Instance Method Details

#view_templateObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/components/easy_admin/navbar_component.rb', line 9

def view_template
  header(
    class: "bg-white border-b border-gray-200 px-6 py-4 lg:ml-64 transition-all duration-300 fixed top-0 right-0 left-0 z-30",
    data: { 
      controller: "navbar-scroll",
      navbar_scroll_target: "navbar"
    }
  ) do
    div(class: "flex items-center justify-between") do
      # Left side - Sidebar toggle + Page title and breadcrumbs
      render_left_section
      
      # Right side - Actions and user menu
      render_right_section
    end
  end
end