Class: CodengageViewComponents::TabItemComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- CodengageViewComponents::TabItemComponent
- Defined in:
- app/components/codengage_view_components/tab_item_component.rb
Instance Method Summary collapse
- #active? ⇒ Boolean
-
#initialize(url:, tab:, icon: "", text: "", classes: "") ⇒ TabItemComponent
constructor
A new instance of TabItemComponent.
- #tab_item_class ⇒ Object
Constructor Details
#initialize(url:, tab:, icon: "", text: "", classes: "") ⇒ TabItemComponent
Returns a new instance of TabItemComponent.
5 6 7 8 9 10 11 |
# File 'app/components/codengage_view_components/tab_item_component.rb', line 5 def initialize(url:, tab:, icon: "", text: "", classes: "") @url = url @tab = tab @icon = icon @text = text @classes = classes end |
Instance Method Details
#active? ⇒ Boolean
13 14 15 |
# File 'app/components/codengage_view_components/tab_item_component.rb', line 13 def active? params[:tab] == @tab end |
#tab_item_class ⇒ Object
17 18 19 |
# File 'app/components/codengage_view_components/tab_item_component.rb', line 17 def tab_item_class active? ? "tab__selected #{@classes}" : "tab__not-selected #{@classes}" end |