Class: PhlexKit::ToastClose
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::ToastClose
- Defined in:
- app/components/phlex_kit/toast/toast_close.rb
Overview
The ×-in-the-corner close button, shown when the region has close_button: true (or a spawn asks for one). See toast_region.rb.
Instance Method Summary collapse
-
#initialize(**attrs) ⇒ ToastClose
constructor
A new instance of ToastClose.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(**attrs) ⇒ ToastClose
Returns a new instance of ToastClose.
5 6 7 |
# File 'app/components/phlex_kit/toast/toast_close.rb', line 5 def initialize(**attrs) @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/components/phlex_kit/toast/toast_close.rb', line 9 def view_template (**mix({ type: :button, class: "pk-toast-close", aria: { label: "Close toast" }, data: { slot: "close", action: "click->phlex-kit--toast#dismiss" } }, @attrs)) do svg( xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewbox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" ) do |s| s.path(d: "M18 6 6 18") s.path(d: "m6 6 12 12") end span(class: "pk-sr-only") { "Close" } end end |