Class: NitroKit::Icon
- Includes:
- LucideRails::RailsHelper, Phlex::Rails::Helpers::ContentTag
- Defined in:
- app/components/nitro_kit/icon.rb
Constant Summary collapse
- SIZE =
{ sm: "size-4", base: "size-5" }
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Attributes inherited from Component
Instance Method Summary collapse
-
#initialize(name:, size: :base, **attrs) ⇒ Icon
constructor
A new instance of Icon.
- #view_template ⇒ Object
Methods inherited from Component
Constructor Details
#initialize(name:, size: :base, **attrs) ⇒ Icon
Returns a new instance of Icon.
11 12 13 14 15 |
# File 'app/components/nitro_kit/icon.rb', line 11 def initialize(name:, size: :base, **attrs) @name = name @size = size @attrs = attrs end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
17 18 19 |
# File 'app/components/nitro_kit/icon.rb', line 17 def name @name end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
17 18 19 |
# File 'app/components/nitro_kit/icon.rb', line 17 def size @size end |
Instance Method Details
#view_template ⇒ Object
19 20 21 |
# File 'app/components/nitro_kit/icon.rb', line 19 def view_template lucide_icon(name, **attrs, class: merge([SIZE[size], attrs[:class]])) end |