Class: TaoUi::Components::IconComponent

Inherits:
TaoOnRails::Components::Base
  • Object
show all
Defined in:
lib/tao_ui/components/icon_component.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view, name, options = {}) ⇒ IconComponent

Returns a new instance of IconComponent.



7
8
9
10
# File 'lib/tao_ui/components/icon_component.rb', line 7

def initialize view, name, options = {}
  @name = name.to_s.dasherize
  super view, options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/tao_ui/components/icon_component.rb', line 5

def name
  @name
end

Class Method Details

.component_nameObject



16
17
18
# File 'lib/tao_ui/components/icon_component.rb', line 16

def self.component_name
  :icon
end

Instance Method Details

#renderObject



12
13
14
# File 'lib/tao_ui/components/icon_component.rb', line 12

def render
  view.(:svg, %Q(<use xlink:href="#icon-#{name}"/>).html_safe, options)
end