Class: Keystone::Ui::TabSwitcherComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Keystone::Ui::TabSwitcherComponent
- 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
-
#tabs ⇒ Object
readonly
Returns the value of attribute tabs.
Instance Method Summary collapse
- #classes ⇒ Object
-
#initialize(tabs:) ⇒ TabSwitcherComponent
constructor
A new instance of TabSwitcherComponent.
- #panel_classes ⇒ Object
- #tab_classes ⇒ Object
- #wrapper_data ⇒ Object
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
#tabs ⇒ Object (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
#classes ⇒ Object
16 17 18 |
# File 'app/components/keystone/ui/tab_switcher_component.rb', line 16 def classes TAB_BAR_CLASSES end |
#panel_classes ⇒ Object
24 25 26 |
# File 'app/components/keystone/ui/tab_switcher_component.rb', line 24 def panel_classes PANEL_CLASSES end |
#tab_classes ⇒ Object
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_data ⇒ Object
28 29 30 |
# File 'app/components/keystone/ui/tab_switcher_component.rb', line 28 def wrapper_data { controller: "tab-switcher" } end |