Class: Spina::MainNavigation::SubNavComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Spina::MainNavigation::SubNavComponent
- Defined in:
- app/components/spina/main_navigation/sub_nav_component.rb
Instance Method Summary collapse
- #active? ⇒ Boolean
- #button_classes ⇒ Object
-
#initialize(name = :content) ⇒ SubNavComponent
constructor
A new instance of SubNavComponent.
- #ul_classes ⇒ Object
Constructor Details
#initialize(name = :content) ⇒ SubNavComponent
Returns a new instance of SubNavComponent.
7 8 9 |
# File 'app/components/spina/main_navigation/sub_nav_component.rb', line 7 def initialize(name = :content) @name = name end |
Instance Method Details
#active? ⇒ Boolean
11 12 13 |
# File 'app/components/spina/main_navigation/sub_nav_component.rb', line 11 def active? helpers.admin_section == @name end |
#button_classes ⇒ Object
15 16 17 18 19 20 21 |
# File 'app/components/spina/main_navigation/sub_nav_component.rb', line 15 def if active? "opacity-100" else "opacity-50" end end |
#ul_classes ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/components/spina/main_navigation/sub_nav_component.rb', line 23 def ul_classes if active? "md:translate-x-20 " else "translate-x-full" end end |