Class: Bulma::ButtonComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/bulma/button_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value = nil, type: "submit", size: nil, color: nil, light: false, fullwidth: false, loading: false) ⇒ ButtonComponent

Returns a new instance of ButtonComponent.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/components/bulma/button_component.rb', line 7

def initialize(
  value = nil,
  type: "submit",
  size: nil,
  color: nil,
  light: false,
  fullwidth: false,
  loading: false
)
  @value = value
  @type = type
  @size = size
  @color = color
  @light = light
  @fullwidth = fullwidth
  @loading = loading
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'app/components/bulma/button_component.rb', line 5

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'app/components/bulma/button_component.rb', line 5

def value
  @value
end

Instance Method Details

#classesObject



25
26
27
28
29
30
31
32
33
34
# File 'app/components/bulma/button_component.rb', line 25

def classes
  class_names(
    "button",
    "is-#{@size}" => @size,
    "is-light" => @light,
    "is-#{@color}" => @color.present?,
    "is-fullwidth" => @fullwidth,
    "is-loading" => @loading
  )
end