Class: Anchor::BannerComponent
- Defined in:
- app/components/anchor/banner_component.rb
Constant Summary collapse
- VARIANT_DEFAULT =
:informational
- VARIANT_MAPPINGS =
{ VARIANT_DEFAULT => "bg-accent-subdued", :critical => "bg-critical-subdued", :success => "bg-success-subdued", :warning => "bg-warning-subdued", }.freeze
- VARIANT_OPTIONS =
VARIANT_MAPPINGS.keys
- ICON_MAPPINGS =
{ critical: "warning-triangle", informational: "info-circle", success: "check-circle", warning: "warning-circle", }.freeze
- ICON_VARIANT_MAPPINGS =
{ critical: "text-critical", informational: "text-accent", success: "text-success", warning: "text-warning", }.freeze
Constants included from ViewHelper
Instance Method Summary collapse
-
#initialize(variant: VARIANT_DEFAULT, **kwargs) ⇒ BannerComponent
constructor
A new instance of BannerComponent.
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, **kwargs) ⇒ BannerComponent
Returns a new instance of BannerComponent.
37 38 39 40 41 42 |
# File 'app/components/anchor/banner_component.rb', line 37 def initialize(variant: VARIANT_DEFAULT, **kwargs) @icon = ICON_MAPPINGS[variant] @icon_variant = ICON_VARIANT_MAPPINGS[variant] super(variant:, **kwargs) end |