Class: RubyUI::ToastIcon

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_ui/toast/toast_icon.rb

Constant Summary

Constants inherited from Base

Base::TAILWIND_MERGER

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Constructor Details

#initialize(variant: nil, **attrs) ⇒ ToastIcon

Returns a new instance of ToastIcon.



5
6
7
8
# File 'lib/ruby_ui/toast/toast_icon.rb', line 5

def initialize(variant: nil, **attrs)
  @variant = variant&.to_sym
  super(**attrs)
end

Instance Method Details

#view_templateObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ruby_ui/toast/toast_icon.rb', line 10

def view_template
  return unless renderable?
  span(**attrs) do
    svg(
      xmlns: "http://www.w3.org/2000/svg",
      width: "16",
      height: "16",
      viewbox: "0 0 24 24",
      fill: "none",
      stroke: "currentColor",
      stroke_width: "2",
      stroke_linecap: "round",
      stroke_linejoin: "round",
      class: "#{svg_classes} -ml-px"
    ) { |s| paths(s) }
  end
end