Class: Trek::IconComponent

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

Instance Method Summary collapse

Instance Method Details

#before_renderObject



24
25
26
# File 'app/components/trek/icon_component.rb', line 24

def before_render
  add_to_sprite
end

#callObject



13
14
15
16
17
18
19
20
21
22
# File 'app/components/trek/icon_component.rb', line 13

def call
  if inline
    svg_as_inline
  else
    tag.svg(**svg_attributes) do
      concat tag.title(title, id: title_id) if title
      concat tag.use("xlink:href": "#c-icon-#{formatted_key}")
    end
  end
end