Class: Anchor::LogoComponent
- Defined in:
- app/components/anchor/logo_component.rb
Constant Summary collapse
- VARIANT_DEFAULT =
:default
- VARIANT_MAPPINGS =
{ VARIANT_DEFAULT => "buoy-logo", :mark => "buoy-logomark", :stacked => "buoy-logo-stacked", }.freeze
- VARIANT_OPTIONS =
VARIANT_MAPPINGS.keys
- VARIANT_ASPECT_RATIO_MAPPINGS =
{ default: "aspect-[500/81]", mark: "aspect-[72/58]", stacked: "aspect-[500/341]", }.freeze
- COLOR_DEFAULT =
:sea
- COLOR_MAPPINGS =
{ COLOR_DEFAULT => "text-brand-sea", :coral => "text-brand-coral", :white => "text-white", }.freeze
- COLOR_OPTIONS =
COLOR_MAPPINGS.keys
Constants included from ViewHelper
Instance Method Summary collapse
-
#initialize(variant: VARIANT_DEFAULT, color: COLOR_DEFAULT, **kwargs) ⇒ LogoComponent
constructor
A new instance of LogoComponent.
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(variant: VARIANT_DEFAULT, color: COLOR_DEFAULT, **kwargs) ⇒ LogoComponent
Returns a new instance of LogoComponent.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/components/anchor/logo_component.rb', line 25 def initialize( variant: VARIANT_DEFAULT, color: COLOR_DEFAULT, **kwargs ) @variant = VARIANT_MAPPINGS[ fetch_or_fallback(VARIANT_OPTIONS, variant, VARIANT_DEFAULT) ] @color = COLOR_MAPPINGS[ fetch_or_fallback(COLOR_OPTIONS, color, COLOR_DEFAULT) ] @variant_aspect_ratio = VARIANT_ASPECT_RATIO_MAPPINGS[variant] super(**kwargs) end |