Class: NitroKit::Icon

Inherits:
Component
  • Object
show all
Defined in:
app/components/nitro_kit/icon.rb

Instance Attribute Summary collapse

Attributes inherited from Component

#attrs

Instance Method Summary collapse

Methods inherited from Component

#builder, from_template

Constructor Details

#initialize(name, size: :md, **attrs) ⇒ Icon

Returns a new instance of Icon.



7
8
9
10
11
12
13
14
15
16
# File 'app/components/nitro_kit/icon.rb', line 7

def initialize(name, size: :md, **attrs)
  @name = name
  @size = size

  super(
    attrs,
    class: size_class,
    stroke_width: 1.5
  )
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



18
19
20
# File 'app/components/nitro_kit/icon.rb', line 18

def name
  @name
end

#sizeObject (readonly)

Returns the value of attribute size.



18
19
20
# File 'app/components/nitro_kit/icon.rb', line 18

def size
  @size
end

Instance Method Details

#view_templateObject



20
21
22
# File 'app/components/nitro_kit/icon.rb', line 20

def view_template
  lucide_icon(name, **dasherized_attrs)
end