Class: Arara::StepConnectorComponent

Inherits:
ActionView::Component::Base
  • Object
show all
Includes:
BaseComponent
Defined in:
app/components/arara/step_connector_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from BaseComponent

#default_data_controller, #default_html_tag, #html_class, #html_content, #html_data, #html_options, #html_tag, included

Constructor Details

#initialize(orientation: 'horizontal', active: false, alternative_label: false, **kw) ⇒ StepConnectorComponent

Returns a new instance of StepConnectorComponent.


5
6
7
8
9
10
11
# File 'app/components/arara/step_connector_component.rb', line 5

def initialize(orientation: 'horizontal', active: false, alternative_label: false, **kw)
  @orientation = orientation
  @active = active
  @alternative_label = alternative_label

  super(tag: 'div', **kw)
end

Instance Attribute Details

#activeObject (readonly)

Returns the value of attribute active


3
4
5
# File 'app/components/arara/step_connector_component.rb', line 3

def active
  @active
end

#alternative_labelObject (readonly)

Returns the value of attribute alternative_label


3
4
5
# File 'app/components/arara/step_connector_component.rb', line 3

def alternative_label
  @alternative_label
end

#orientationObject (readonly)

Returns the value of attribute orientation


3
4
5
# File 'app/components/arara/step_connector_component.rb', line 3

def orientation
  @orientation
end

Instance Method Details

#default_html_classObject


13
14
15
16
17
18
19
20
21
# File 'app/components/arara/step_connector_component.rb', line 13

def default_html_class
  classes = %w(MuiStepConnector-root)
  classes.push("MuiStepConnector-horizontal") if orientation == "horizontal"
  classes.push("MuiStepConnector-vertical") if orientation == "vertical"
  classes.push("MuiStepConnector-active") if active
  classes.push("Mui-disabled") unless active
  classes.push("MuiStepConnector-alternativeLabel") if alternative_label
  classes.join(" ")
end

#line_optionsObject


23
24
25
26
27
28
29
30
# File 'app/components/arara/step_connector_component.rb', line 23

def line_options
  classes = %w(MuiStepConnector-line)
  classes.push("MuiStepConnector-lineHorizontal") if orientation == "horizontal"
  classes.push("MuiStepConnector-lineVertical") if orientation == "vertical"
  {
    class: classes.join(" ")
  }
end