Class: Icon::Component

Inherits:
Lookbook::BaseComponent
  • Object
show all
Defined in:
app/components/lookbook/icon/component.rb

Instance Method Summary collapse

Constructor Details

#initialize(name:, size: 4, **html_attrs) ⇒ Component

Returns a new instance of Component.



3
4
5
6
7
# File 'app/components/lookbook/icon/component.rb', line 3

def initialize(name:, size: 4, **html_attrs)
  @alpine_data = name.is_a?(Symbol) ? alpine_encode(name.to_s.tr("_", "-")) : name
  @size = size || 4
  super(**html_attrs)
end

Instance Method Details

#size_remsObject



9
10
11
# File 'app/components/lookbook/icon/component.rb', line 9

def size_rems
  "#{@size * 0.25}rem"
end