Class: Practical::Views::IconComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Practical::Views::IconComponent
- Includes:
- ActiveModel::Serializers::JSON
- Defined in:
- app/components/practical/views/icon_component.rb
Instance Attribute Summary collapse
-
#family ⇒ Object
Returns the value of attribute family.
-
#fixed_width ⇒ Object
Returns the value of attribute fixed_width.
-
#label ⇒ Object
Returns the value of attribute label.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#variant ⇒ Object
Returns the value of attribute variant.
Instance Method Summary collapse
- #attributes ⇒ Object
- #attributes=(hash) ⇒ Object
- #call ⇒ Object
-
#initialize(name:, family:, variant: nil, fixed_width: true, label: nil, options: {}) ⇒ IconComponent
constructor
A new instance of IconComponent.
Methods included from ElementHelper
Constructor Details
#initialize(name:, family:, variant: nil, fixed_width: true, label: nil, options: {}) ⇒ IconComponent
Returns a new instance of IconComponent.
18 19 20 21 22 23 24 25 |
# File 'app/components/practical/views/icon_component.rb', line 18 def initialize(name:, family:, variant: nil, fixed_width: true, label: nil, options: {}) self.name = name self.family = family self.variant = variant self.fixed_width = fixed_width self.label = label self. = end |
Instance Attribute Details
#family ⇒ Object
Returns the value of attribute family.
6 7 8 |
# File 'app/components/practical/views/icon_component.rb', line 6 def family @family end |
#fixed_width ⇒ Object
Returns the value of attribute fixed_width.
6 7 8 |
# File 'app/components/practical/views/icon_component.rb', line 6 def fixed_width @fixed_width end |
#label ⇒ Object
Returns the value of attribute label.
6 7 8 |
# File 'app/components/practical/views/icon_component.rb', line 6 def label @label end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'app/components/practical/views/icon_component.rb', line 6 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'app/components/practical/views/icon_component.rb', line 6 def @options end |
#variant ⇒ Object
Returns the value of attribute variant.
6 7 8 |
# File 'app/components/practical/views/icon_component.rb', line 6 def variant @variant end |
Instance Method Details
#attributes ⇒ Object
14 15 16 |
# File 'app/components/practical/views/icon_component.rb', line 14 def attributes { "name" => nil, "family" => nil, "variant" => nil, "fixed_width" => nil, "label" => nil, "options" => nil } end |
#attributes=(hash) ⇒ Object
8 9 10 11 12 |
# File 'app/components/practical/views/icon_component.rb', line 8 def attributes=(hash) hash.each do |key, value| public_send("#{key}=", value) end end |
#call ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'app/components/practical/views/icon_component.rb', line 27 def call tag.wa_icon(**mix({ "name": name, "family": family, "variant": variant, "fixed-width": fixed_width, "label": label }, )) end |