Class: SdrViewComponents::Elements::ButtonLinkComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- SdrViewComponents::Elements::ButtonLinkComponent
- Defined in:
- app/components/sdr_view_components/elements/button_link_component.rb
Overview
Component for a button that is a link
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(link:, label: nil, variant: :primary, classes: [], bordered: true, size: nil, **options) ⇒ ButtonLinkComponent
constructor
rubocop:disable Metrics/ParameterLists.
Methods inherited from BaseComponent
#args_for, #merge_actions, #merge_classes
Constructor Details
#initialize(link:, label: nil, variant: :primary, classes: [], bordered: true, size: nil, **options) ⇒ ButtonLinkComponent
rubocop:disable Metrics/ParameterLists
7 8 9 10 11 12 13 14 15 16 |
# File 'app/components/sdr_view_components/elements/button_link_component.rb', line 7 def initialize(link:, label: nil, variant: :primary, classes: [], bordered: true, size: nil, **) # rubocop:disable Metrics/ParameterLists @link = link @label = label @variant = variant @options = @classes = classes @bordered = bordered @size = size super() end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
18 19 20 |
# File 'app/components/sdr_view_components/elements/button_link_component.rb', line 18 def label @label end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
18 19 20 |
# File 'app/components/sdr_view_components/elements/button_link_component.rb', line 18 def link @link end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 |
# File 'app/components/sdr_view_components/elements/button_link_component.rb', line 20 def call link_to(link, class: ComponentSupport::ButtonSupport.classes(classes: @classes, variant: @variant, bordered: @bordered, size: @size), **@options) do label || content end end |