Class: Anchor::BannerComponent
- Defined in:
- app/components/anchor/banner_component.rb
Constant Summary collapse
- VARIANT_DEFAULT =
:neutral- VARIANT_MAPPINGS =
{ VARIANT_DEFAULT => "bg-neutral", :informational => "bg-informational-subdued", :success => "bg-success-subdued", :critical => "bg-critical-subdued", :warning => "bg-warning-subdued", }.freeze
- VARIANT_OPTIONS =
VARIANT_MAPPINGS.keys
Instance Method Summary collapse
-
#initialize(variant: VARIANT_DEFAULT, classes: nil) ⇒ BannerComponent
constructor
A new instance of BannerComponent.
Methods inherited from Component
Methods included from ViewHelper
Methods included from FetchOrFallbackHelper
Constructor Details
#initialize(variant: VARIANT_DEFAULT, classes: nil) ⇒ BannerComponent
Returns a new instance of BannerComponent.
13 14 15 16 17 18 19 20 |
# File 'app/components/anchor/banner_component.rb', line 13 def initialize(variant: VARIANT_DEFAULT, classes: nil) @variant = VARIANT_MAPPINGS[ fetch_or_fallback(VARIANT_OPTIONS, variant, VARIANT_DEFAULT) ] @classes = classes super end |