Class: Practical::Views::ButtonComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Practical::Views::ButtonComponent
- Includes:
- Practical::Views::Button::Styling
- Defined in:
- app/components/practical/views/button_component.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#appearance ⇒ Object
Returns the value of attribute appearance.
-
#color_variant ⇒ Object
Returns the value of attribute color_variant.
-
#options ⇒ Object
Returns the value of attribute options.
-
#size ⇒ Object
Returns the value of attribute size.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(type:, appearance: nil, color_variant: nil, size: nil, options: {}) ⇒ ButtonComponent
constructor
A new instance of ButtonComponent.
Methods included from ElementHelper
Constructor Details
#initialize(type:, appearance: nil, color_variant: nil, size: nil, options: {}) ⇒ ButtonComponent
Returns a new instance of ButtonComponent.
7 8 9 10 11 |
# File 'app/components/practical/views/button_component.rb', line 7 def initialize(type:, appearance: nil, color_variant: nil, size: nil, options: {}) @type = type = initialize_style_utilities(appearance: appearance, color_variant: color_variant, size: size) end |
Instance Attribute Details
#appearance ⇒ Object
Returns the value of attribute appearance.
5 6 7 |
# File 'app/components/practical/views/button_component.rb', line 5 def appearance @appearance end |
#color_variant ⇒ Object
Returns the value of attribute color_variant.
5 6 7 |
# File 'app/components/practical/views/button_component.rb', line 5 def color_variant @color_variant end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'app/components/practical/views/button_component.rb', line 5 def end |
#size ⇒ Object
Returns the value of attribute size.
5 6 7 |
# File 'app/components/practical/views/button_component.rb', line 5 def size @size end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'app/components/practical/views/button_component.rb', line 5 def type @type end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/components/practical/views/button_component.rb', line 13 def call defaults = { type: type, class: css_classes_from_style_utilities } if type.to_sym == :submit defaults[:data] = { disable: true } end = mix(defaults, ) tag.(content, **) end |