Class: Anchor::IconComponent
- Defined in:
- app/components/anchor/icon_component.rb
Constant Summary collapse
- SIZE_DEFAULT =
:large
- SIZE_MAPPINGS =
{ small: 16, medium: 20, SIZE_DEFAULT => 24, }.freeze
- SIZE_OPTIONS =
SIZE_MAPPINGS.keys
Constants included from ViewHelper
Instance Method Summary collapse
-
#initialize(icon:, size: SIZE_DEFAULT, **kwargs) ⇒ IconComponent
constructor
A new instance of IconComponent.
Methods inherited from Component
Methods included from ViewHelper
#anchor_form_with, #anchor_svg, #deep_blank?, #merge_options, #popover_trigger_attributes
Methods included from FetchOrFallbackHelper
Constructor Details
#initialize(icon:, size: SIZE_DEFAULT, **kwargs) ⇒ IconComponent
Returns a new instance of IconComponent.
11 12 13 14 15 16 |
# File 'app/components/anchor/icon_component.rb', line 11 def initialize(icon:, size: SIZE_DEFAULT, **kwargs) @icon = icon @size = SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, SIZE_DEFAULT)] super(**kwargs) end |