Class: Practical::Views::ButtonToComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Practical::Views::ButtonToComponent
- Includes:
- Practical::Views::Button::Styling
- Defined in:
- app/components/practical/views/button_to_component.rb
Instance Attribute Summary collapse
-
#appearance ⇒ Object
Returns the value of attribute appearance.
-
#color_variant ⇒ Object
Returns the value of attribute color_variant.
-
#html_options ⇒ Object
Returns the value of attribute html_options.
-
#options ⇒ Object
Returns the value of attribute options.
-
#size ⇒ Object
Returns the value of attribute size.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(url:, options:, appearance: nil, color_variant: nil, size: nil, html_options: {}) ⇒ ButtonToComponent
constructor
A new instance of ButtonToComponent.
Methods included from ElementHelper
Constructor Details
#initialize(url:, options:, appearance: nil, color_variant: nil, size: nil, html_options: {}) ⇒ ButtonToComponent
Returns a new instance of ButtonToComponent.
7 8 9 10 11 12 |
# File 'app/components/practical/views/button_to_component.rb', line 7 def initialize(url:, options:, appearance: nil, color_variant: nil, size: nil, html_options: {}) self.url = url self. = self. = 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_to_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_to_component.rb', line 5 def color_variant @color_variant end |
#html_options ⇒ Object
Returns the value of attribute html_options.
5 6 7 |
# File 'app/components/practical/views/button_to_component.rb', line 5 def @html_options end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'app/components/practical/views/button_to_component.rb', line 5 def @options end |
#size ⇒ Object
Returns the value of attribute size.
5 6 7 |
# File 'app/components/practical/views/button_to_component.rb', line 5 def size @size end |
#url ⇒ Object
Returns the value of attribute url.
5 6 7 |
# File 'app/components/practical/views/button_to_component.rb', line 5 def url @url end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/components/practical/views/button_to_component.rb', line 14 def call html_option_defaults = { class: css_classes_from_style_utilities, data: {disable: true} } = mix(html_option_defaults, ) helpers.(url, **, **) { content } end |