Class: Ui::IconComponent

Inherits:
SparkComponents::Component
  • Object
show all
Defined in:
app/components/spark/ui/icon_component.rb

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#before_renderObject



8
9
10
11
# File 'app/components/spark/ui/icon_component.rb', line 8

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

#renderObject



13
14
15
# File 'app/components/spark/ui/icon_component.rb', line 13

def render
  Esvg.use(name, tag_attrs)
end