InvalidEmailWarningAlertComponent

InfoGeneratePackages

The provided code defines a Ruby class named `WarningColorAlertComponent` that inherits from `ApplicationComponent`. In this class, the `template` method is defined, which builds a warning alert component using HTML div and span tags, along with an SVG for a visual warning icon. The main functionality includes creating a div element with class `alert alert-warning` and role `alert` to visually signify a warning to the user. Inside this div, an SVG warning icon is defined with specific attributes like stroke properties and path data. Additionally, a span element is used to display a warning text message, "Warning: Invalid email address!". Notably, the use of frozen_string_literal at the top of the file is a Ruby directive that makes all string literals in the file immutable.

# frozen_string_literal: true

class WarningColorAlertComponent < ApplicationComponent
  def template
    div(class: "alert alert-warning", role: "alert") do
      svg(xmlns: "http://www.w3.org/2000/svg", class: "stroke-current shrink-0 h-6 w-6", fill: "none", viewBox: "0 0 24 24") do |svg|
        svg.path(stroke_linecap: "round", stroke_linejoin: "round", stroke_width: "2", d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z")
      end
      span { "Warning: Invalid email address!" }
    end
  end
end