Class: Arara::SelectComponent

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from BaseComponent

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

Constructor Details

#initialize(variant: "default", id: nil, name: nil, label:, selected_value: nil, selected_label: nil, **kw) ⇒ SelectComponent

Returns a new instance of SelectComponent.



8
9
10
11
12
13
14
15
16
# File 'app/components/arara/select_component.rb', line 8

def initialize(variant: "default", id: nil, name: nil, label:, selected_value: nil, selected_label: nil, **kw)
  super(tag: "div", variant: variant, **kw)

  @id = id
  @name = name
  @label = label
  @selected_value = selected_value
  @selected_label = selected_label
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'app/components/arara/select_component.rb', line 4

def id
  @id
end

#labelObject (readonly)

Returns the value of attribute label.



4
5
6
# File 'app/components/arara/select_component.rb', line 4

def label
  @label
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'app/components/arara/select_component.rb', line 4

def name
  @name
end

#selected_labelObject (readonly)

Returns the value of attribute selected_label.



4
5
6
# File 'app/components/arara/select_component.rb', line 4

def selected_label
  @selected_label
end

#selected_valueObject (readonly)

Returns the value of attribute selected_value.



4
5
6
# File 'app/components/arara/select_component.rb', line 4

def selected_value
  @selected_value
end

Instance Method Details

#default_data_controllerObject



18
19
20
# File 'app/components/arara/select_component.rb', line 18

def default_data_controller
  "mdc-select"
end

#default_html_classObject



22
23
24
25
# File 'app/components/arara/select_component.rb', line 22

def default_html_class
  return "mdc-select mdc-select--outlined" if user_variant == "outlined"
  "mdc-select"
end