Class: SdrViewComponents::Elements::IconButtonLinkComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- SdrViewComponents::Elements::IconButtonLinkComponent
- Defined in:
- app/components/sdr_view_components/elements/icon_button_link_component.rb
Overview
Component for a button which is an icon
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #button_icon ⇒ Object
- #classes ⇒ Object
-
#initialize(icon:, label:, classes: [], icon_classes: [], link: nil, **options) ⇒ IconButtonLinkComponent
constructor
rubocop:disable Metrics/ParameterLists.
Methods inherited from BaseComponent
#args_for, #merge_actions, #merge_classes
Constructor Details
#initialize(icon:, label:, classes: [], icon_classes: [], link: nil, **options) ⇒ IconButtonLinkComponent
rubocop:disable Metrics/ParameterLists
7 8 9 10 11 12 13 14 15 |
# File 'app/components/sdr_view_components/elements/icon_button_link_component.rb', line 7 def initialize(icon:, label:, classes: [], icon_classes: [], link: nil, **) # rubocop:disable Metrics/ParameterLists @icon = icon @label = label @classes = classes @link = link @options = @icon_classes = icon_classes super() end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
17 18 19 |
# File 'app/components/sdr_view_components/elements/icon_button_link_component.rb', line 17 def label @label end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
17 18 19 |
# File 'app/components/sdr_view_components/elements/icon_button_link_component.rb', line 17 def link @link end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
17 18 19 |
# File 'app/components/sdr_view_components/elements/icon_button_link_component.rb', line 17 def @options end |
Instance Method Details
#button_icon ⇒ Object
23 24 25 |
# File 'app/components/sdr_view_components/elements/icon_button_link_component.rb', line 23 def helpers.public_send(:"#{@icon}_icon", classes: @icon_classes) end |
#classes ⇒ Object
19 20 21 |
# File 'app/components/sdr_view_components/elements/icon_button_link_component.rb', line 19 def classes merge_classes(%w[border border-0], @classes) end |