Class: IconComponent

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

Overview

Icon — icon element using Fomantic-UI icon font.

Usage:

Icon(name: "home")
Icon(name: "heart", color: :red, size: :large)
Icon(name: "spinner", loading: true)

Constant Summary

Constants inherited from Component

Component::HTML_OPTIONS

Instance Method Summary collapse

Methods inherited from Component

default, #initialize, #render_in, slot

Constructor Details

This class inherits a constructor from Component

Instance Method Details

#to_sObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/components/icon_component.rb', line 25

def to_s
  classes = class_names(
    name,
    size,
    color,
    flipped && "#{flipped} flipped",
    rotated && "#{rotated} rotated",
    corner && "#{corner} corner",
    { "disabled" => disabled, "loading" => loading, "fitted" => fitted,
      "link" => link, "circular" => circular, "bordered" => bordered,
      "inverted" => inverted },
    "icon"
  )

  tag.i(**merge_html_options(class: classes))
end