Class: FoxTail::AlertComponent

Inherits:
DismissibleComponent show all
Defined in:
app/components/fox_tail/alert_component.rb

Constant Summary collapse

SEVERITY_ICONS =
{ success: "check-circle", warning: "exclamation-triangle", error: "exclamation-circle" }.freeze
DEFAULT_SEVERITY_ICON =
"information-circle"

Instance Attribute Summary collapse

Attributes inherited from BaseComponent

#html_attributes

Instance Method Summary collapse

Methods inherited from DismissibleComponent

#before_render, #call, stimulus_controller_name, #stimulus_controller_options

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

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'app/components/fox_tail/alert_component.rb', line 7

def id
  @id
end

Instance Method Details

#borderObject



65
66
67
68
69
70
71
72
73
# File 'app/components/fox_tail/alert_component.rb', line 65

def border
  if options[:border].is_a?(TrueClass)
    :basic
  elsif !options[:border]
    :none
  else
    (options[:border] || :none).to_sym
  end
end

#border?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'app/components/fox_tail/alert_component.rb', line 61

def border?
  border != :none
end

#use_stimulus?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'app/components/fox_tail/alert_component.rb', line 75

def use_stimulus?
  super && dismissible?
end