Class: Material::ButtonComponent

Inherits:
ApplicationComponent
  • Object
show all
Defined in:
app/components/material/button_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = "", html_options = {}, disabled: false, button_type: :filled) ⇒ ButtonComponent

Returns a new instance of ButtonComponent.



25
26
27
28
29
30
# File 'app/components/material/button_component.rb', line 25

def initialize(name = "", html_options = {}, disabled: false, button_type: :filled)
  @name         = name
  @html_options = disabled ? html_options.merge(disabled: "disabled") : html_options
  @disabled     = disabled
  @button_type  = button_type
end

Instance Attribute Details

#button_typeObject (readonly)

Returns the value of attribute button_type.



23
24
25
# File 'app/components/material/button_component.rb', line 23

def button_type
  @button_type
end

#disabledObject (readonly)

Returns the value of attribute disabled.



22
23
24
# File 'app/components/material/button_component.rb', line 22

def disabled
  @disabled
end

Instance Method Details

#container_classesObject



32
33
34
# File 'app/components/material/button_component.rb', line 32

def container_classes
  send :"#{button_type}_button_container_classes"
end

#content_classesObject



36
37
38
# File 'app/components/material/button_component.rb', line 36

def content_classes
  send :"#{button_type}_button_content_classes"
end

#overlay_classesObject



40
41
42
# File 'app/components/material/button_component.rb', line 40

def overlay_classes
  send :"#{button_type}_button_overlay_classes"
end