Class: Keystone::Ui::TabSwitcherComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/keystone/ui/tab_switcher_component.rb

Constant Summary collapse

TAB_BAR_CLASSES =
"mb-8 flex flex-wrap justify-center gap-2"
TAB_BASE_CLASSES =
"rounded-lg px-4 py-2 text-sm font-semibold transition text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white"
PANEL_CLASSES =
"hidden"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tabs:) ⇒ TabSwitcherComponent

Returns a new instance of TabSwitcherComponent.



12
13
14
# File 'app/components/keystone/ui/tab_switcher_component.rb', line 12

def initialize(tabs:)
  @tabs = tabs
end

Instance Attribute Details

#tabsObject (readonly)

Returns the value of attribute tabs.



10
11
12
# File 'app/components/keystone/ui/tab_switcher_component.rb', line 10

def tabs
  @tabs
end

Instance Method Details

#classesObject



16
17
18
# File 'app/components/keystone/ui/tab_switcher_component.rb', line 16

def classes
  TAB_BAR_CLASSES
end

#panel_classesObject



24
25
26
# File 'app/components/keystone/ui/tab_switcher_component.rb', line 24

def panel_classes
  PANEL_CLASSES
end

#tab_classesObject



20
21
22
# File 'app/components/keystone/ui/tab_switcher_component.rb', line 20

def tab_classes
  "#{TAB_BASE_CLASSES} data-[active]:bg-accent-500/10 data-[active]:text-accent-600 dark:data-[active]:bg-accent-500/10 dark:data-[active]:text-accent-400"
end

#wrapper_dataObject



28
29
30
# File 'app/components/keystone/ui/tab_switcher_component.rb', line 28

def wrapper_data
  { controller: "tab-switcher" }
end