Class: Bs5::ToastComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Bs5::ToastComponent
show all
- Includes:
- ComponentsHelper, ViewComponent::SlotableV2
- Defined in:
- app/components/bs5/toast_component.rb
Constant Summary
ComponentsHelper::COMPONENTS
Instance Attribute Summary collapse
Instance Method Summary
collapse
#bs5_collapse, #bs5_popover, #bs5_tooltip
Constructor Details
14
15
16
17
18
19
|
# File 'app/components/bs5/toast_component.rb', line 14
def initialize(options = {})
@options = options.symbolize_keys
@color = @options.delete(:color)
@close_button = @options.fetch(:close_button, true)
@data_options = @options.(:animation, :autohide, :delay)
end
|
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
9
10
11
|
# File 'app/components/bs5/toast_component.rb', line 9
def color
@color
end
|
Instance Method Details
#component_attributes ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'app/components/bs5/toast_component.rb', line 25
def component_attributes
default_options = {
role: :alert,
aria: { live: 'assertive', atomic: true },
data: data_options
}
@options[:class] = component_class
@options.merge(default_options)
end
|
21
22
23
|
# File 'app/components/bs5/toast_component.rb', line 21
def
!!
end
|
#white_text? ⇒ Boolean
37
38
39
|
# File 'app/components/bs5/toast_component.rb', line 37
def white_text?
color? && color.in?(i[primary secondary success danger dark])
end
|