Class: CopyButton::Component

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target: nil, icon: :code, size: :md, **attrs) ⇒ Component

Returns a new instance of Component.



5
6
7
8
9
10
# File 'app/components/lookbook/copy_button/component.rb', line 5

def initialize(target: nil, icon: :code, size: :md, **attrs)
  @icon = icon
  @size = size
  @target = target
  @button_attrs = attrs
end

Instance Attribute Details

#button_attrsObject (readonly)

Returns the value of attribute button_attrs.



3
4
5
# File 'app/components/lookbook/copy_button/component.rb', line 3

def button_attrs
  @button_attrs
end

#iconObject (readonly)

Returns the value of attribute icon.



3
4
5
# File 'app/components/lookbook/copy_button/component.rb', line 3

def icon
  @icon
end

#sizeObject (readonly)

Returns the value of attribute size.



3
4
5
# File 'app/components/lookbook/copy_button/component.rb', line 3

def size
  @size
end

#targetObject (readonly)

Returns the value of attribute target.



3
4
5
# File 'app/components/lookbook/copy_button/component.rb', line 3

def target
  @target
end

Instance Method Details

#icon_sizeObject



12
13
14
# File 'app/components/lookbook/copy_button/component.rb', line 12

def icon_size
  IconButton::Component::ICON_SIZES[size]
end