Class: Tramway::NavbarComponent

Inherits:
TailwindComponent show all
Defined in:
app/components/tramway/navbar_component.rb

Overview

Navbar component

Constant Summary collapse

%w[
  flex items-center justify-between border-zinc-800 px-4 py-3 shadow-sm backdrop-blur sm:px-6
].freeze
MOBILE_BUTTON_CLASSES =
%w[
  inline-flex items-center justify-center rounded-md p-2 transition-colors hover:bg-zinc-800 hover:text-zinc-50
  focus:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:ring-offset-2
  focus-visible:ring-offset-zinc-950
].freeze
MOBILE_MENU_CLASSES =
%w[
  fixed inset-0 z-50 hidden h-screen w-screen flex-col border-r border-zinc-800 bg-zinc-950 px-4 py-6 shadow-lg
  transition-transform transform -translate-x-full duration-300 ease-in-out pt-16
].freeze

Constants inherited from TailwindComponent

TailwindComponent::SIZE_CLASSES

Constants included from Helpers::ViewsHelper

Helpers::ViewsHelper::FORM_SIZES

Instance Method Summary collapse

Methods included from Helpers::ViewsHelper

#tramway_back_button, #tramway_badge, #tramway_button, #tramway_cell, #tramway_chat, #tramway_container, #tramway_flash, #tramway_form_for, #tramway_header, #tramway_main_container, #tramway_row, #tramway_table, #tramway_title

Methods included from Helpers::ComponentHelper

#component

Methods included from Helpers::DecorateHelper

#tramway_decorate

Constructor Details

#initialize(**options) ⇒ NavbarComponent

Returns a new instance of NavbarComponent.



21
22
23
24
25
# File 'app/components/tramway/navbar_component.rb', line 21

def initialize(**options)
  @title = { text: options[:title], link: options[:title_link] || '/' }
  @left_items = options[:left_items]
  @right_items = options[:right_items]
end

Instance Method Details

#mobile_button_classesObject



35
36
37
# File 'app/components/tramway/navbar_component.rb', line 35

def mobile_button_classes
  MOBILE_BUTTON_CLASSES.join(' ')
end

#mobile_menu_classesObject



39
40
41
# File 'app/components/tramway/navbar_component.rb', line 39

def mobile_menu_classes
  MOBILE_MENU_CLASSES.join(' ')
end


27
28
29
# File 'app/components/tramway/navbar_component.rb', line 27

def navbar_classes
  NAVBAR_CLASSES.join(' ')
end

#title_classesObject



31
32
33
# File 'app/components/tramway/navbar_component.rb', line 31

def title_classes
  'text-base font-semibold text-zinc-50'
end