ErrorAlertWithIconComponent
InfoGeneratePackages
This code defines a Ruby class named ErrorColorAlertComponent, which inherits from ApplicationComponent. This class is used to generate an HTML structure for displaying an error message. The main functionality lies in the template method, which creates a div element with a class "alert alert-error" and a role attribute set to "alert." Inside this div, an SVG is embedded to visually represent the error, alongside a span element that contains the error message "Error! Task failed successfully." This component is likely used in a web application to notify users of errors in a visually appealing and standardized way.
# frozen_string_literal: true
class ErrorColorAlertComponent < ApplicationComponent
def template
div(class: "alert alert-error", 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: "M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z")
end
span { "Error! Task failed successfully." }
end
end
end
Try a prompt