Class: FoxTail::DismissibleComponent

Inherits:
BaseComponent show all
Includes:
Concerns::HasStimulusController
Defined in:
app/components/fox_tail/dismissible_component.rb

Direct Known Subclasses

AlertComponent, ToastComponent

Defined Under Namespace

Classes: StimulusController

Instance Attribute Summary

Attributes inherited from BaseComponent

#html_attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseComponent

classname_merger, #initialize, stimulus_merger, use_stimulus?, #with_html_attributes, #with_html_class

Methods inherited from Base

fox_tail_config

Constructor Details

This class inherits a constructor from FoxTail::BaseComponent

Class Method Details

.stimulus_controller_nameObject



31
32
33
# File 'app/components/fox_tail/dismissible_component.rb', line 31

def stimulus_controller_name
  :dismissible
end

Instance Method Details

#before_renderObject



10
11
12
13
14
# File 'app/components/fox_tail/dismissible_component.rb', line 10

def before_render
  super

  html_attributes[:class] = classnames theme.apply(:root, self), html_class
end

#callObject



16
17
18
# File 'app/components/fox_tail/dismissible_component.rb', line 16

def call
   :div, content, html_attributes
end

#stimulus_controller_optionsObject



20
21
22
23
24
25
26
27
28
# File 'app/components/fox_tail/dismissible_component.rb', line 20

def stimulus_controller_options
  {
    remove: remove?,
    auto_close: auto_close?,
    delay: delay,
    dismissing_classes: theme.apply("root/dismissing", self),
    dismissed_classes: theme.apply("root/dismissed", self)
  }
end