Class: Impulse::DialogComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Impulse::DialogComponent
- Defined in:
- app/components/impulse/dialog_component.rb
Constant Summary collapse
- DEFAULT_SIZE =
:md- SIZE_MAPPINGS =
{ :sm => "awc-dialog--sm", DEFAULT_SIZE => "", :lg => "awc-dialog--lg" }.freeze
- DEFAULT_FULLSCREEN =
:never- FULLSCREEN_MAPPINGS =
{ DEFAULT_FULLSCREEN => "", :always => "awc-dialog--fullscreen", :sm_down => "awc-dialog--fullscreen-sm-down", :md_down => "awc-dialog--fullscreen-md-down", :lg_down => "awc-dialog--fullscreen-lg-down", :xl_down => "awc-dialog--fullscreen-xl-down" }.freeze
Instance Method Summary collapse
-
#initialize(title:, id: self.class.generate_id, size: DEFAULT_SIZE, center: true, fullscreen: DEFAULT_FULLSCREEN, **system_args) ⇒ DialogComponent
constructor
A new instance of DialogComponent.
Methods inherited from ApplicationComponent
Methods included from Helpers::AttributesHelper
Constructor Details
#initialize(title:, id: self.class.generate_id, size: DEFAULT_SIZE, center: true, fullscreen: DEFAULT_FULLSCREEN, **system_args) ⇒ DialogComponent
Returns a new instance of DialogComponent.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/components/impulse/dialog_component.rb', line 27 def initialize(title:, id: self.class.generate_id, size: DEFAULT_SIZE, center: true, fullscreen: DEFAULT_FULLSCREEN, **system_args) @title = title @id = id @center = center @system_args = system_args @system_args[:tag] = :"awc-dialog" @system_args[:id] = @id @system_args[:class] = class_names( system_args[:class], SIZE_MAPPINGS[fetch_or_fallback(SIZE_MAPPINGS.keys, size, DEFAULT_SIZE)], FULLSCREEN_MAPPINGS[fetch_or_fallback(FULLSCREEN_MAPPINGS.keys, fullscreen, DEFAULT_FULLSCREEN)], "awc-dialog" ) end |