Class: UI::Toast
Constant Summary collapse
- AUTO_DISMISS_DELAY =
8000
Constants inherited from Base
Instance Method Summary collapse
- #action(href:, text:) ⇒ Object
-
#initialize(**props) ⇒ Toast
constructor
A new instance of Toast.
- #view_template ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(**props) ⇒ Toast
Returns a new instance of Toast.
13 14 15 16 |
# File 'app/views/ui/toast.rb', line 13 def initialize(**props) super @action = nil end |
Instance Method Details
#action(href:, text:) ⇒ Object
42 43 44 45 |
# File 'app/views/ui/toast.rb', line 42 def action(href:, text:) @action = {href:, text:} nil end |
#view_template ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/views/ui/toast.rb', line 18 def view_template output( data: { controller: "dismissable", dismissable_auto_dismiss_time_value: auto_dismiss_delay }, class: classes ) do div class: "w-full min-h-8 py-1 px-2 inline-flex items-start justify-between gap-6" do span(class: "mt-0.5") { yield } span(class: "flex items-center gap-x-6") do render_action if dismissable? data: {action: "dismissable#dismiss"}, class: do Icon(name: :x_mark, variant: :outline, class: "mt-px") end end end end end end |