Class: UI::Alert
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::Alert
- Includes:
- AlertBehavior
- Defined in:
- app/components/ui/alert.rb
Overview
Alert - Phlex implementation
A callout component for displaying important information to users. Uses AlertBehavior module for shared styling logic.
Instance Method Summary collapse
-
#initialize(variant: :default, classes: "", **attributes) ⇒ Alert
constructor
A new instance of Alert.
- #view_template(&block) ⇒ Object
Methods included from AlertBehavior
#alert_base_classes, #alert_classes, #alert_html_attributes, #alert_variant_classes, #render_alert
Constructor Details
#initialize(variant: :default, classes: "", **attributes) ⇒ Alert
Returns a new instance of Alert.
20 21 22 23 24 |
# File 'app/components/ui/alert.rb', line 20 def initialize(variant: :default, classes: "", **attributes) @variant = variant @classes = classes @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
26 27 28 29 30 |
# File 'app/components/ui/alert.rb', line 26 def view_template(&block) div(**alert_html_attributes) do yield if block_given? end end |