Class: SdrViewComponents::Elements::Tabs::PaneComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/sdr_view_components/elements/tabs/pane_component.rb

Overview

Component for rendering a tab pane in a tabbed interface.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseComponent

#args_for, #merge_actions, #merge_classes

Constructor Details

#initialize(id:, tab_id:, active: false) ⇒ PaneComponent

Returns a new instance of PaneComponent.



8
9
10
11
12
13
# File 'app/components/sdr_view_components/elements/tabs/pane_component.rb', line 8

def initialize(id:, tab_id:, active: false)
  @id = id
  @tab_id = tab_id
  @active = active
  super()
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



15
16
17
# File 'app/components/sdr_view_components/elements/tabs/pane_component.rb', line 15

def id
  @id
end

#tab_idObject (readonly)

Returns the value of attribute tab_id.



15
16
17
# File 'app/components/sdr_view_components/elements/tabs/pane_component.rb', line 15

def tab_id
  @tab_id
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'app/components/sdr_view_components/elements/tabs/pane_component.rb', line 17

def active?
  @active
end

#classesObject



21
22
23
# File 'app/components/sdr_view_components/elements/tabs/pane_component.rb', line 21

def classes
  merge_classes(%w[tab-pane fade], active? ? %w[show active] : nil)
end