Class: Spark::Icon

Inherits:
ActionView::Component::Base
  • Object
show all
Includes:
Component
Defined in:
app/components/spark/icon.rb

Constant Summary collapse

SIZE =
{ xsmall: 10, small: 14, base: 16, text: "1em", medium: 18, large: 24, xlarge: 32 }

Instance Method Summary collapse

Constructor Details

#initializeIcon

Returns a new instance of Icon.



11
12
13
14
15
16
17
18
# File 'app/components/spark/icon.rb', line 11

def initialize(*)
  super

  raise no_icon_found if !Rails.env.production? && !Esvg.find_symbol(@name)
  tag_attrs.add width: icon_width, height: icon_height, content: @yield

  classname.base = "spark-icon"
end