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