Class: Icon::Component

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

Constant Summary collapse

ICON_CACHE =
{}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Component.



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

def initialize(name:, size: 4, stroke: 2, **html_attrs)
  @icon_name = name.to_s.tr("_", "-")
  @size = size || 4
  @stroke = stroke
  super(**html_attrs)
end

Instance Attribute Details

#strokeObject (readonly)

Returns the value of attribute stroke.



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

def stroke
  @stroke
end

Instance Method Details

#size_remsObject



14
15
16
# File 'app/components/lookbook/icon/component.rb', line 14

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