Class: Alchemy::Admin::Icon
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Alchemy::Admin::Icon
- Defined in:
- app/components/alchemy/admin/icon.rb
Overview
Render a Remix icon
Instance Attribute Summary collapse
-
#css_class ⇒ Object
readonly
Returns the value of attribute css_class.
-
#icon_name ⇒ Object
readonly
Returns the value of attribute icon_name.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(icon_name, options = {}) ⇒ Icon
constructor
A new instance of Icon.
Constructor Details
#initialize(icon_name, options = {}) ⇒ Icon
Returns a new instance of Icon.
12 13 14 15 16 17 |
# File 'app/components/alchemy/admin/icon.rb', line 12 def initialize(icon_name, = {}) @icon_name = icon_name @style = [:style].nil? ? "line" : [:style] @size = [:size] @css_class = [:class] end |
Instance Attribute Details
#css_class ⇒ Object (readonly)
Returns the value of attribute css_class.
6 7 8 |
# File 'app/components/alchemy/admin/icon.rb', line 6 def css_class @css_class end |
#icon_name ⇒ Object (readonly)
Returns the value of attribute icon_name.
6 7 8 |
# File 'app/components/alchemy/admin/icon.rb', line 6 def icon_name @icon_name end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
6 7 8 |
# File 'app/components/alchemy/admin/icon.rb', line 6 def size @size end |
#style ⇒ Object (readonly)
Returns the value of attribute style.
6 7 8 |
# File 'app/components/alchemy/admin/icon.rb', line 6 def style @style end |
Instance Method Details
#call ⇒ Object
19 20 21 |
# File 'app/components/alchemy/admin/icon.rb', line 19 def call content_tag("alchemy-icon", nil, name: ri_icon, size: size, "icon-style": ri_style, class: css_class) end |