Class: Tailwinds::NavbarComponent

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

Overview

Navbar component

Constant Summary

Constants inherited from TailwindComponent

TailwindComponent::SIZE_CLASSES

Constants included from Tramway::Helpers::ViewsHelper

Tramway::Helpers::ViewsHelper::FORM_SIZES

Instance Method Summary collapse

Methods included from Tramway::Helpers::ViewsHelper

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

Methods included from Tramway::Helpers::ComponentHelper

#component

Methods included from Tramway::Helpers::DecorateHelper

#tramway_decorate

Constructor Details

#initialize(**options) ⇒ NavbarComponent

Returns a new instance of NavbarComponent.



6
7
8
9
10
# File 'app/components/tailwinds/navbar_component.rb', line 6

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



24
25
26
27
28
# File 'app/components/tailwinds/navbar_component.rb', line 24

def mobile_button_classes
  theme_classes(
    classic: 'text-gray-200 focus:outline-none'
  )
end

#mobile_menu_classesObject



30
31
32
33
34
35
36
37
# File 'app/components/tailwinds/navbar_component.rb', line 30

def mobile_menu_classes
  theme_classes(
    classic: [
      'hidden', 'inset-0', 'flex-col', 'bg-gray-900', 'shadow-inner', 'h-screen', 'fixed', 'z-50', 'w-screen',
      'transition-transform', 'transform', '-translate-x-full', 'duration-300', 'ease-in-out', 'pt-16'
    ].join(' ')
  )
end


12
13
14
15
16
# File 'app/components/tailwinds/navbar_component.rb', line 12

def navbar_classes
  theme_classes(
    classic: 'py-2 px-4 sm:px-8 flex justify-between items-center bg-gray-900 shadow-md'
  )
end

#title_classesObject



18
19
20
21
22
# File 'app/components/tailwinds/navbar_component.rb', line 18

def title_classes
  theme_classes(
    classic: 'text-xl font-semibold text-gray-100'
  )
end