Class: Bulma::IconComponent

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(icon, text: nil, color: nil, size: nil) ⇒ IconComponent

Returns a new instance of IconComponent.



17
18
19
20
21
# File 'app/components/bulma/icon_component.rb', line 17

def initialize(icon, text: nil, color: nil, size: nil)
  @text = text
  @color = color
  @icon = IoniconComponent.new(icon)
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



15
16
17
# File 'app/components/bulma/icon_component.rb', line 15

def text
  @text
end

Instance Method Details

#classesObject



23
24
25
# File 'app/components/bulma/icon_component.rb', line 23

def classes
  class_names("icon", "has-text-#{@color}" => @color.present?)
end